Skip to content

Getsumi3/nodejs-express-server-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

nodejs-express-server-template

A simple nodejs express server template

SETUP

  1. Install required packages:
npm install
  1. Start the server. By default, it will start on http://0.0.0.0:4000
  • production server
npm start
  • development server (uses nodemon for reload on file changes)
npm run dev

STRUCTURE

This templates uses a simple MVC-like structure.

All server related files are placed in /src directory.

PROJECT TREE
  • src ----------------------------- project source directory
    • controllers ------------- api controllers. responsible for processing requests and generating responses
    • models ----------------- business data, rules and logic
      • .....
    • App.js ------------------- main server file. don't break it
    • Auth.js ------------------ middleware. prevents unauthorized requests
    • config.js ---------------- main config file: bearer token; version; etc.
  • package.json
  • README.md --------------- pls notice me

Default packages:

  • axios - Promise based HTTP client for the browser and node.js
  • body-parser - Node.js body parsing middleware.
  • cors - CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
  • express - Fast, unopinionated, minimalist web framework for node.
  • nodemon - nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.

About

A simple nodejs express server template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published