I am using express.js for my website. I have created the directory structure using 'express-generator'. It contains 'views' folder to render views. It also has 'routes' folder for routing purpose. Now my question is where should I define or do the core logic code?
Where should I do the core logic code in express js?
153 views Asked by Pritam Kale At
1
For organization purposes, I use
/controllers
for my, well, controllers (which I believe is what you mean). Express really doesn't care where you put your code, just as long as you correctly userequire('./path/to/whatever/directoryname/you/choose/filename')
in your routes and views andmodule.exports = controllerToExpose;
in your controllers.