How to use the swagger-express-ts.ApiPath function in swagger-express-ts

To help you get started, we’ve selected a few swagger-express-ts 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 dimeloper / ts-simple-backend / server / controllers / user.controller.ts View on Github external
import * as express from 'express';
import 'reflect-metadata';
import { ApiOperationGet, ApiOperationPost, ApiPath, SwaggerDefinitionConstant, } from 'swagger-express-ts';
import UserModel from '../models/user.model';

@ApiPath({
  description: 'User Controller',
  name: 'User Controller',
  path: '/api/users',
  // security: { apiKeyHeader: [] }, - use if route is protected
})
export class UserController {

  private router: express.Router;

  constructor() {
    this.router = express.Router();
    this.router.get('/', this.getUsers);
    this.router.post('/', this.createUser);
  }

  public getRouter(): express.Router {
github olivierlsc / swagger-express-ts / src / version / version.controller.ts View on Github external
import 'reflect-metadata';
import {
    interfaces,
    controller,
    httpGet,
    requestParam,
} from 'inversify-express-utils';
import {
    ApiPath,
    SwaggerDefinitionConstant,
    ApiOperationGet,
} from 'swagger-express-ts';
import * as express from 'express';
import { VersionsService } from './versions.service';

@ApiPath({
    name: 'Versions',
    path: '/versions/{id}',
})
@controller('/versions/:id')
@injectable()
export class VersionController implements interfaces.Controller {
    public static TARGET_NAME: string = 'VersionController';

    constructor(
        @inject(VersionsService.TARGET_NAME)
        private versionsService: VersionsService
    ) {}

    @ApiOperationGet({
        description: 'Get version object',
        parameters: {
github olivierlsc / swagger-express-ts / src / cars / cars.controller.ts View on Github external
interfaces,
    httpPost,
    requestParam,
    httpPut,
} from 'inversify-express-utils';
import {
    ApiPath,
    ApiOperationGet,
    ApiOperationPost,
    SwaggerDefinitionConstant,
    ApiOperationPut,
} from 'swagger-express-ts';
import { CarsService } from './cars.service';
import { CarModel } from './car.model';

@ApiPath({
    path: '/cars',
    name: 'Cars',
    security: { apiKeyHeader: [] },
})
@controller('/cars')
@injectable()
export class CarsController implements interfaces.Controller {
    constructor(@inject(CarsService.name) private carsService: CarsService) {}

    @ApiOperationGet({
        description: 'Get cars objects list',
        summary: 'Get cars list',
        responses: {
            200: {
                type: SwaggerDefinitionConstant.Response.Type.ARRAY,
                model: 'Car',