I downloaded ExpressJS framework and tried to create a simple MVC apps a'la Rails...
I get the impression that ExpressJS framework works better if you put the whole thing in app.js. Like... the whole code.
I tried to create another file other than index.js inside routes folder (let's call it something.js) so I can instantiate some JS controller code in app.js vs putting everything in one file. That doesn't work at all, "something" is undefined.
It turned out that I have to either put everything in app.js or in routes/index.js in order for ExpressJS to work correctly.
The whole experienced was... unexpected.
I'm kind of used to Rails MVC. So please tell me: am I using ExpressJS the way it shouldn't be used?
UPDATE: Thanks for the answers guys. Kind of what I would have guessed to hear => use module. Which is probably fine. Module in CommonJS does have a bit of bookkeeping beforehand.
I did have a bit of a hunch that I needed to know more about CommonJS and proper modern JS practices.