Where should I do the core logic code in express js?

172 views Asked by At

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?

1

There are 1 answers

0
Kris Molinari On

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 use require('./path/to/whatever/directoryname/you/choose/filename') in your routes and views and module.exports = controllerToExpose; in your controllers.