mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			548 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			548 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
| 'use strict';
 | |
| 
 | |
| const path = require('path');
 | |
| const koaStatic = require('koa-static');
 | |
| const swaggerUi = require('swagger-ui-dist');
 | |
| 
 | |
| module.exports = async ({ strapi }) => {
 | |
|   strapi.server.routes([
 | |
|     {
 | |
|       method: 'GET',
 | |
|       path: '/plugins/documentation/(.*)',
 | |
|       async handler(ctx, next) {
 | |
|         ctx.url = path.basename(ctx.url);
 | |
| 
 | |
|         return koaStatic(swaggerUi.getAbsoluteFSPath(), {
 | |
|           maxage: 86400000,
 | |
|           defer: true,
 | |
|         })(ctx, next);
 | |
|       },
 | |
|       config: {
 | |
|         auth: false,
 | |
|       },
 | |
|     },
 | |
|   ]);
 | |
| };
 | 
