How to use the koa-swagger-decorator.SwaggerRouter function in koa-swagger-decorator

To help you get started, we’ve selected a few koa-swagger-decorator 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 javieraviles / node-typescript-koa-rest / src / protectedRoutes.ts View on Github external
import { SwaggerRouter } from 'koa-swagger-decorator';
import controller = require('./controller');

const protectedRouter = new SwaggerRouter();

// USER ROUTES
protectedRouter.get('/users', controller.user.getUsers);
protectedRouter.get('/users/:id', controller.user.getUser);
protectedRouter.post('/users', controller.user.createUser);
protectedRouter.put('/users/:id', controller.user.updateUser);
protectedRouter.delete('/users/:id', controller.user.deleteUser);
protectedRouter.delete('/testusers', controller.user.deleteTestUsers);

// Swagger endpoint
protectedRouter.swagger({
    title: 'node-typescript-koa-rest',
    description: 'API REST using NodeJS and KOA framework, typescript. TypeORM for SQL with class-validators. Middlewares JWT, CORS, Winston Logger.',
    version: '1.5.0'
});