How to create nested routes with parameters using NestJS?

Answer

This is what I'm currently using, but what if I have many children routes? I don't want to have a single, fat Controller class. Ideally I would be able to create different child routes inside different Controller classes


i think you need this?

import {Controller, Get, Param} from "@nestjs/common";

@Controller('accounts/:account')
export class TestController{

@Get('resource2/:someParam/whatever')
arsPW(@Param('account') account, @Param('someParam') someparam){
console.log(':account/resource2/:someParam/whatever',account,someparam)
return account+'_'+someparam+'___';
}

@Get('resource1/:someparam')
aRSP(@Param('account') account, @Param('someparam') someparam){
console.log(':account/resource1/:someParam',account,someparam)
return account+'_'+someparam;
}


@Get()
getget(){
console.log('get');
return 'aaa';
}

}

 

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---