| Start |
|---|
| Basic program for signup Through this example, it will be explained to divide the node.js code into different modules/folders for better undertandibility. Following this technique makes it easier for other developers to understand the code as he can directly refer to concerned file instead of going through whole code. The major use is when you are working in a team and a new developer joins at a later stage, it will get easier for him to gel up with the code itself. index.js :- This file will manage server connection. config.js:-This file will manage all the configuration related params which will remain same throughout. user.js:- Model file where schema is defined userController:- This file contains the function for user signUp userRoutes.js:- This the route for userController The above example may appear too big but if a beginner at node.js with a little blend of express knowledge tries to go through this will find it easy and really helpful. RemarksI would recommend to a beginner to start with this style of coding. And if anybody can suggest a better way(p.s i opted this technique and is working efficiently for me in an app used by more then 100k users), feel free for any suggestions. TIA. |
Read Article
https://develop.horje.com/learn/1434/reference