DEV Community

Discussion on: Structuring my Node.js RESTful API using Express

Collapse
 
dmfay profile image
Dian Fay

I've never had to worry about supporting multiple versions of a REST API at the same time, and I favor data access without models in JavaScript so that in particular is a bit of a moot point personally. I would try to avoid versioning models if at all possible simply because more code = more points of failure. There's no way around versioning routes because they have to do different things, but it should be possible to do those things with the same models even if you have to do a little fine-tuning here & there in the route code. If your schema is changing radically enough that that isn't practical, you probably have two different applications instead of two API versions. Unless you're tied into it for business reasons, such as "being Facebook", in which case all bets are off.

The conventional container folder name is "lib" in Node, although you'll occasionally see "src" instead.

Thread Thread
 
jjjjcccjjf profile image
ο½…ο½Žο½„ο½ο½Ž

All points taken. Thank you! πŸ‘πŸ‘