How to organize large Node.js projects

后端 未结 6 981
春和景丽
春和景丽 2021-01-29 20:22

What are some good ways to organize large Node.js projects?

For example, an app making use of both express.js and socket.io? This would include both application logical

6条回答
  •  心在旅途
    2021-01-29 20:45

    If you are a beginner in this area, I suggest you take a look at existing projects that are loved by developers. Some of them are:

    • Sails.js - 18k stars. You can take a look how they organized APP structure at the link I provided. A great website has an explanation for each folder in the structure.

    • Express.js generator - 800 stars. There is the great and simple template to start working with Express.js. Here you can notice how they split routes from the app.

    By the way, so many developers did your case before, and you can just fork it and upgrade.

    • Kioska. Look how they separate events into different files at the events/ folder.

    • Ballons.io 2.3k stars. Unfortunately, they have the whole socket server in one file but you can learn the whole structure of the app with node.js and socket.io

提交回复
热议问题