Answer the question
In order to leave comments, you need to log in
Where is the right place to keep node.js application logic?
If you take express, then it is rendered directly in the router
var express = require('express');
var router = express.Router();
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;
Answer the question
In order to leave comments, you need to log in
function(req, res, next) {
res.render('index', { title: 'Express' });
}
module.exports.routeName = function(req, res, next) {
res.render('index', { title: 'Express' });
};
const controllerName = require('./controllers/controllerName.js');
router.get('/', controllerName.routeName);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question