mirror of
https://github.com/strapi/strapi.git
synced 2025-07-09 01:52:36 +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,
|
|
},
|
|
},
|
|
]);
|
|
};
|