I have a Nest JS application with 2 routes that simply returns the data(preferences) from the database.
I want to create 2 routes:
I'm new to NestJS. These 2 routes should be under one module. Is this achievable?
The 2nd route works but I get an error saying 404 Not Found.
@Module({
controllers: ['PreferenceController'],
providers: ['PreferenceService']
})
@Controller()
export class PreferenceController{
constructor(private readonly preferenceService: PreferenceService) {}
@Get('preference/:x/:y/:z')
getItem(@Param() param) {
return this.preferenceService.getItem(param);
}
@Get(':id')
getFeature(@Param() param) {
return this.preferenceService.getFeature(param);
}
}
routes = [
path: '/api',
children: [
{
path: '/items',
module: 'PreferenceModule'
},
{
path: '/features',
module: 'PreferenceModule'
}
]
]