GithubHelp home page GithubHelp logo

gggauravgandhi / the-node-skeleton Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 686 KB

Bare minimum code to get you started with node. Now powered with ES6.

License: MIT License

JavaScript 96.57% HTML 3.43%

the-node-skeleton's Introduction

The Node Skeleton (beta)#

A basic Node Boiler-Plate Code, for quickly setting up API.

Getting Started

git clone https://github.com/preeminence/node-skeleton.git
cd node-skeleton
npm install
npm run dev

Usage

package.json

{
    "name": "the-node-skeleton",
    "version": "1.1.0",
    "description": "The Node skeleton",
    "main": "index.js",
    "scripts": {
      "dev": "export NODE_ENV=development && echo 'Node environment set to development' && nodemon index.js && exit 0",
      "start": "(pm2 stop 'the-node-skeleton' || echo 'Nothing to kill') && pm2 start index.js --name 'the-node-skeleton'",
    },
    "keywords": [
      "Node",
      "Skeleton",
      "ES6"
    ],
    "author": "preeminece",
    "license": "MIT",
  }

Directory Structure

  • Root

    • index.js - Starting point for app execution.

    • init.js - Initialization sequences which executes once while app starts.

    • initServer.js - This is called from init.js, it loads the config and initializes the server based on it.

    • initScript.sh - Shell Script.

      • Deletes the existing git repo
      • Initializes new git repo
      • Creates the logs directory
      • Triggers NPM install
      • Creates a fresh .gitignore
    • routes.js - main router file, called and mounted from init.js.

      • this where all the sub-routers from user_modules are mounted on.
      • this will also contains the 404 not-found middle-ware and also the 500 server error middle-ware
  • config

    • app.json - Main config file for the app.

      {
         "development": { //NODE_ENV 
           "server": {   //Server Setting
             "port": 4444, // the Port Number
             "protocol": "http", // the Protocol
             "socket": true // enable Socket ?
           },
           "db": { // DataBase
               "host": "localhost", // DB Host
               "port": 27017, // DB port
               "database": "mongoDB" // DB type
               }
           } 
       }
      
    • bunyan.js - Initializes the the BunyanJS, Exports the Logger.

    • error.js - Common Errors Config, Exports getError function.

      • getError
        • input - errorSting, data
        • returns - the errorObject.
    • helper.js - Processes NODE_ENV and logs info or error.

    • index.js - calls, helper.js, bunyan.js and app.json and returns logger.

    • ssl the directory in which all the ssl files and certificates.

  • user_modules This will contain all the code from the users.

    • Sample user created module.
    • module_name
      • router.js - all the routes related to the module.
      • crud.js - the CRUD for the module.
      • middleware.js - the middleware to be used in the module.
      • schema.js
      • validator.js

the-node-skeleton's People

Contributors

elvisjfern avatar gggauravgandhi avatar mujtabakably avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.