Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
start({ app, fileList, routes, customSetting, }) {
server.use((ctx, next) => __awaiter(this, void 0, void 0, function* () {
if (ctx.path === documentationPath) { // koa static barfs on root url w/o trailing slash
ctx.redirect(ctx.path + "/");
}
else {
yield next();
}
}));
server.use(koa_mount_1.default(documentationPath, serve(swaggerUiAssetPath)));
printf(chalk_1.default.blue.bold("koa-swapi"), "document build succeed, path", chalk_1.default.blue(documentationPath));
DEBUG("documentationPath", documentationPath);
server.use(koa_mount_1.default(jsonPath, (ctx, next) => __awaiter(this, void 0, void 0, function* () {
const swaggerJSON = yield swaggerBuilder_1.default.build(routes, customSetting, ctx);
ctx.body = JSON.stringify(swaggerJSON);
})));
app.use(koa_mount_1.default(server));
}
}
start({ app, fileList, routes, customSetting, }) {
server.use((ctx, next) => __awaiter(this, void 0, void 0, function* () {
if (ctx.path === documentationPath) { // koa static barfs on root url w/o trailing slash
ctx.redirect(ctx.path + "/");
}
else {
yield next();
}
}));
server.use(koa_mount_1.default(documentationPath, serve(swaggerUiAssetPath)));
printf(chalk_1.default.blue.bold("koa-swapi"), "document build succeed, path", chalk_1.default.blue(documentationPath));
DEBUG("documentationPath", documentationPath);
server.use(koa_mount_1.default(jsonPath, (ctx, next) => __awaiter(this, void 0, void 0, function* () {
const swaggerJSON = yield swaggerBuilder_1.default.build(routes, customSetting, ctx);
ctx.body = JSON.stringify(swaggerJSON);
})));
app.use(koa_mount_1.default(server));
}
}
server.use((ctx, next) => __awaiter(this, void 0, void 0, function* () {
if (ctx.path === documentationPath) { // koa static barfs on root url w/o trailing slash
ctx.redirect(ctx.path + "/");
}
else {
yield next();
}
}));
server.use(koa_mount_1.default(documentationPath, serve(swaggerUiAssetPath)));
printf(chalk_1.default.blue.bold("koa-swapi"), "document build succeed, path", chalk_1.default.blue(documentationPath));
DEBUG("documentationPath", documentationPath);
server.use(koa_mount_1.default(jsonPath, (ctx, next) => __awaiter(this, void 0, void 0, function* () {
const swaggerJSON = yield swaggerBuilder_1.default.build(routes, customSetting, ctx);
ctx.body = JSON.stringify(swaggerJSON);
})));
app.use(koa_mount_1.default(server));
}
}