Git Product home page Git Product logo

nodejs-structure's Introduction

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 :)

nodejs-structure's People

Contributors

abdul-majid-ashrafi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.