Node express project architecture when use versioning

Viewed 21

I'm working on a node+express+mongo project, and I am wondering how the project architecture would be when working with versioning, should I put all the folders in /v1 and then make the same thing for /v2, or is it just the routes, I'm searching for the best practice of this case enter image description here

1 Answers

It depends on what versioning tool you use. With git I would do different branches for major versions at least and add the version number to the config by all of them, so the routing and URI creation would know what the version number we are talking about. I would not add the version number to the directory structure.

I am not sure about other versioning systems, maybe in some of them you would need to have separate directories for each major version, but if so, then code reusage will be an issue and you have to separate the common parts to a common directory or to a different project.

Related