I wrote a small express application and put my routes in a different file, routes.js:
module.exports = function(server) { // Server is my express object
server.get('/something', (req, res) => {
// Stuff
});
// Some other routes
}
To use them in my main file, server.js, I require them like this:
require('./routes')(server);
This works fine, but I've never seen a require without an assignment like
const bla = require('some-module');.
Is the way I'm using require here even valid and / or a good practice?