DEV Community

Hamklien Ablay
Hamklien Ablay

Posted on

How should i create my admin route on my server?

Hello, i'm here as a humble junior looking for someone who can illuminate me, i'm doing a personal project as practice to improve my skills with some technologies, on this occasion using NestJS to create the backend.

Here is my question, i have public and privates routes, should i create a controller just for public and private to separate both path or just one controller for both?

i have dto's when is public route to return specifics data and private as well.

Here some example

  @Get('/:id')
  @Serialize(productDto)
  getProductById(@Param('id') id: string) {
    return ...
  }

  @Get('/admin/:id')
  @Serialize(productPrivateDto)
  getProductByIdAdmin(@Param('id') id: string) {
    return ...
  }
Enter fullscreen mode Exit fullscreen mode

I would appreciate any help (✿╹◡╹)

Top comments (0)