Skip to content

Abdul-majid-ashrafi/nodejs-structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Structure of a NodeJS API Project

Use folder structure

3 Layer architecture

The idea is to use the principle of separation of concerns to move the business logic away from the node.js API Routes.

Don’t put your business logic inside the controllers.

You may be tempted to just use the express.js controllers to store our business logic of your application, but its not a good way.

Use a service layer for your business logic it will be very good.

The Structure

NodeJS/Javascript have a characteristic that some people find usefull, but it can make you go deep in the wrong way, and this is the freedom of choose how you want to structure your project (Remember that NodeJS is not a framework like Rails or .Net). Only the experience working in different projects will let you define the best structure for every situation.

I suggest the follow my structure.

Follow these command lines:

  1. Opne terminal
  2. run git clone https://github.com/Abdul-majid-ashrafi/nodejs-structure.git
  3. run cd nodejs-structure
  4. run npm install
  5. run npm start

Happy Coding :)

About

Structure of a NodeJS API Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published