The way we deal with it is, we have a route per "type" or "base path" - e.g. consider an api with /api/foo and /api/bar. Then we could have a folder routes with a file foo.js and bar.js - each with the routes belonging to those, rather than having one single file with all routes that would eventually become very, very long as the api grew.
Amazing! I have to admit I had no intention or expectation of my comment leading to you editing the initial post. How amazing it is that we can discuss, share and learn from each other!
Alright, I get your point!
The way we deal with it is, we have a route per "type" or "base path" - e.g. consider an api with
/api/foo
and/api/bar
. Then we could have a folderroutes
with a filefoo.js
andbar.js
- each with the routes belonging to those, rather than having one single file with all routes that would eventually become very, very long as the api grew.This makes sense to me now!
I think your suggested way may be better than what I've done in this article. I'll update it.
Thanks for sharing! :)
Amazing! I have to admit I had no intention or expectation of my comment leading to you editing the initial post. How amazing it is that we can discuss, share and learn from each other!
Indeed! :D