Search code examples
javascriptswaggernestjs

How to group endpoints in Nest js with Swagger


I want to group API endpoints based on tags in Nest.js such that all employee endpoints under Employee tag, all site endpoints under Site tag etc. Currently, all my endpoints are under default tag. I am using Swagger in Nest.js.

How can I implement it?


Solution

  • To attach a controller to a specific tag, use the @ApiTags(...tags) decorator.

    @ApiTags('cats')
    @Controller('cats')
    export class CatsController {}
    

    docs