How to use the swagger-routes-express.summarise function in swagger-routes-express

To help you get started, we’ve selected a few swagger-routes-express 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 Armour / vue-typescript-admin-mock-server / mock / index.js View on Github external
res.header('Pragma', 'no-cache');
    res.header('Expires', '-1');
    next();
});
// Read and swagger config file
const apiDefinition = yamljs_1.default.load(path_1.default.resolve(__dirname, 'swagger.yml'));
// Create mock functions based on swaggerConfig
const options = {
    security: {
        AccessTokenAuth: security_1.accessTokenAuth
    }
};
const connectSwagger = connector(api, apiDefinition, options);
connectSwagger(app);
// Print swagger router api summary
const apiSummary = summarise(apiDefinition);
console.log(apiSummary);
// Catch 404 error
app.use((req, res, next) => {
    const err = new Error('Not Found');
    res.status(404).json({
        message: err.message,
        error: err
    });
});
// Create HTTP server.
const server = http_1.default.createServer(app);
// Listen on provided port, on all network interfaces.
server.listen(port);
server.on('error', onError);
console.log('Mock server started on port ' + port + '!');
// Event listener for HTTP server "error" event.

swagger-routes-express

Connect Express route controllers to restful paths using a Swagger 2 or OpenAPI 3 definition file

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis