How to use the koa-mount.default function in koa-mount

To help you get started, we’ve selected a few koa-mount examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github haowen737 / koa-swapi / built / lib / swaggerServer.js View on Github external
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));
    }
}
github haowen737 / koa-swapi / built / lib / swaggerServer.js View on Github external
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));
    }
}
github haowen737 / koa-swapi / built / lib / swaggerServer.js View on Github external
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));
    }
}

koa-mount

Mounting middleware for koa

MIT
Latest version published 6 years ago

Package Health Score

62 / 100
Full package analysis

Popular koa-mount functions