I'm planning a medium-sized node project because I have a java background, grade did everything for me regarding the general structure of the project. And as far as i already know, the MVC pattern is not very common in Node projects.
Now i am wondering how i can structure my project.
I already have some files: Server-related: -server.js just the app.listen(port, callback) function -app.js in here are all expressjs settings like app.use(xyz)
client-related: my public files index.html, index.css and some client side javascript
And some business logic:
my project does some heavy calculations on the server side and just displays the results in the index.html, so my business logic contains the most files.
For example: a PriorityQueue.js File, that is just a library class for a PriorityQueue Implementation.
Furthermore I have implemented some other Data structures and Algorithms.
I do not have many routes, just /error and /home
My Questions is now: How do i structure all these files, to have a clean and beautiful project structure? I already read the AirBnB and the Google JS Style Guide, but they don't say anything about the project structure.
Your help is much appreciated! Thanks.
I generally create a server.js main file and routes/, controllers/ and services/ and models/ subdirectories. If I have a "files" service I will then create files.route.js, files.controller.js, files.service.js and files.model.js.