I mainly worked with Rails-like frameworks in the past. Recently, I’ve been looking into Express.js. I’ve noticed that most of the examples do the routing inside the main app.js, or do the rendering inside route.js and I’m a bit uncomfortable with that.
A slightly more familiar example is the mvc folder in Express.js’ github page, but even then, I find the way the routing is done a bit weird (also, view folder inside controllers? What’s happening?).
My question is, what change of mentality should I perform, or is there a standard way of using Express.js that clearly separates the concern of routing and controllers and make them work neatly?
Thanks.
After a bit more of experimentation, I answered my own question.
Express is not made for these kind of tasks. Frameworks like Geddy or Tower are, although none of them are production-ready like Express is.
There is a module called Express-resource that does just what I want. Nevertheless, in the worst case, it’s relatively easy to build one’s own routing / controlling mechanism in Express.