How to use the tsoa.Tags function in tsoa

To help you get started, we’ve selected a few tsoa 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 lukeautry / ts-app / api / controllers / widgets-controller.ts View on Github external
color: "blue",
    id: 1,
    label: "first widget",
  },
];

@Route("widgets")
export class WidgetsController {
  @Get()
  @Tags("Widgets")
  public async GetWidgets(): Promise {
    return widgets;
  }

  @Get("{widgetId}")
  @Tags("Widgets")
  public async GetWidget(widgetId: number): Promise {
    const widget = widgets.find((w) => w.id === widgetId);
    if (!widget) {
      throw new ServerError(`no widget found with id ${widgetId}`);
    }

    return widget;
  }
}

tsoa

Build swagger-compliant REST APIs using TypeScript and Node

MIT
Latest version published 16 days ago

Package Health Score

95 / 100
Full package analysis