Giter Club home page Giter Club logo

backend's Introduction

NodeJS,Mongoose,Express Project in MVC Architecture

Supported version of nodejs >= 12, Supported version of mongoose >= 6

About

  • This is a Node application, developed using MVC pattern with Node.js, ExpressJS, and Mongoose.
  • MongoDB database is used for data storage, with object modeling provided by Mongoose.

Initial

  1. $ npm install

  2. $ npm start

  3. Credentials

    • One user with User role,

    Default User credentials

    username : Stefanie48 password : vizPsjm3g7FIfSH

    • One user with Admin role,

    Default Admin credentials

    username : Orland_Hudson password : 9MLITjWr8dgT70W

How to use generated APIs:

Click here to visit documentation

How to run with Docker ? :

  • if you have docker file you can execute following command
  • build the image $ docker build --pull --rm -f "Dockerfile" -t <imageName>:latest "."
  • execute the command $ docker run -p 3000:3000 <imageName>

Folder structure:

  ├── app.js       - starting point of the application
  ├── config
  │   └── db.js    - contains api database connection
  ├── constants    - contains commonly used constants 
  ├── controllers               
  │   └── platform - contains business logic
  ├── jobs         - cron jobs
  ├── models       - models of application
  ├── postman      - postman collection files
  ├── routes       - contains all the routes of application
  ├── services     - contains commonly used services
  ├── views        - templates
  └── utils        - contains utility functions    

Detail Description of Files and folders

  1. app.js
  • entry point of application.
  1. config
  • passport strategy files
  • database connection files
  1. constants
  • constants used across application.
  1. controllers
  • Controller files that contains Business logic
	├── controller
		├── platform
			└── modelNameController.js        - contains CRUD Operations
  1. jobs
  • Cron jobs
  1. middleware
  • Middleware files for authentication, authorization and role-access.
  1. models
  • Database models
  1. postman
  • Postman collection of APIs (Import this JSON in Postman to run the APIs)
  1. public
  • Assets used in application
  1. routes
	├── routes
		├── platform
			├── modelNameRoutes.js   - contains CRUD operation routes
			└── index.js             - exports model Routes
		└── index.js                 - exports platform routes

  • index.js file, exports platform routes, imported into app.js to access all the routes.
  1. services
	├── services
		├── jobs                     - cron jobs
		└── auth.js                  - Authentication module service

  1. utils
	├── utils
		├── validations              - joi validations files for every model
		├── dbService.js             - Database functions 
		├── messages.js              - Messages used in sending response 
		├── responseCode.js          - response codes 
		└── validateRequest.js       - validate request based on model schema

  1. env files
  • You can add credentials and port, database values as per your environment(Development/Production).
  • If you are running test environment then test cases will run using test database,and its configuration is there inside app.js

backend's People

Contributors

placu97 avatar

Watchers

 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.