Does anyone have any sug…

1 minute read

Does anyone have any suggestions how to scope and name the endpoints for a nest application? I am struggling to find a way to group controllers (and their services) in a way that makes sense. We are using ngrx data on the front end so we have singular and plural endpoints by convention. Right now some of our endpoint libraries are at <scope>/api/<scope>(s) for the singular and plural endpoints but then the names seem really odd. Wondering if anyone else has thought about this at all.

Responses:

could you give me an example?

always use singular naming

api/payment

get delete get/{id} …

If you keep rest in mind the business layer should deal with the rest

Ok but that doesn’t work the ngrx data convention. Because it you call get many it query’s GET payments but if you call get one it query’s GET payment/:id as an example.

So I have to have a singular and plural controller.

Why are you using NGRX data

Because it is significantly easy to maintain all of our objects in Angular and manage crud applications on them.

You can also overwrite the naming convention in NGRX. Sorry i’ve moved away from NGRX recently because of poor design principles

If i get change later I’ll write and example repo. But got 3 contracts going on. I’ve had to stop NX vue integration4

Something like this? https://github.com/nestjsx/nest-router

Updated: