I have app architecture(approximately): (I'm using Express framework)
-routes
-views
-public
-app.js
I tried to use a route in app.js in this way:
var router = require('routes');
app.get('/', router.get);
app.get('/otherRoute', router.get);
File index.js in routes folder:
exports.get = function(req, res) {
res.render('index',{
title: "Express",
a: '<a href="#">Link</a>'
});
};
I generated only this route '/', '/otherRoute' also generated by index.js of course. I just show the schema.
routes/index.js, routes/about.js, ...). Or will be better to use a one file to handle routes?node.js apps.Thank you.