Coder Social home page Coder Social logo

suvankar-kundu / node-express-es6-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 11.0 849 KB

Boilerplate for Node.js projects with lint, transpile and build configurations.

License: MIT License

JavaScript 100.00%
nodejs express es6 api boilerplate babel build moongose nodejs-framework nodejs-server

node-express-es6-boilerplate's Introduction

Node, Express & ES6 REST API Starter Kit

This is a straightforward starter kit for building REST APIs with ES6 and Express.This project contains the following.

  • HTTP API server using Express
  • CORS support
  • Best Practice Structure
  • JWT middleware for authorization
  • ES6 support via babel
  • Body Parsing via body-parser

Getting Started

1. Clone repo    
`git clone https://github.com/suvankar-kundu/node-express-es6-boilerplate.git <dir_name>`    

2. Change directory    
`cd <dir_name>`    

3. Remove git folder    
*nix: `rm -rf ./.git`    
win: `RD /S /Q .git`    

4. Edit **package.json**    
Change `name, version, description, repository, author, bugs, homepage`    

5. Install packages    
`npm install`    

6. Update packages    
`npm update`    

Command

  1. Run npm run build
    Transpile ES6 to dist directory.

  2. Run npm run start
    This will start the application with specific port.

  3. Run npm run lint
    This will check eslint error.

  4. Run npm run test
    This will run all the test cases.

License

MIT

node-express-es6-boilerplate's People

Contributors

suvankar-kundu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

node-express-es6-boilerplate's Issues

Unable to npm start due to errors

Fresh clone and followed instructions. npm build followed by npm start results in:

twolf@sbridge:/tmp/node-express-es6-boilerplate$ npm run start

> [email protected] start /tmp/node-express-es6-boilerplate
> babel-node src/index.js

2020-02-01T16:21:40.792Z - info: Server started on port 5000
events.js:282
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '../logs/2020-02-01.application.log'
Emitted 'error' event on  instance at:
    at WriteStream.<anonymous> (/tmp/node-express-es6-boilerplate/node_modules/winston-daily-rotate-file/index.js:571:16)
    at WriteStream.emit (events.js:305:20)
    at WriteStream.EventEmitter.emit (domain.js:483:12)
    at internal/fs/streams.js:343:14
    at FSReqCallback.oncomplete (fs.js:153:23) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '../logs/2020-02-01.application.log'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `babel-node src/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/twolf/.npm/_logs/2020-02-01T16_21_40_809Z-debug.log

Vulnerabilities found in packages

After npm install and npm update I get several vulnerability warnings at time of this post. The audit details:

twolf@sbridge:/tmp/node-express-es6-boilerplate$ npm audit
                                                                                
                       === npm audit security report ===                        
                                                                                
# Run  npm install [email protected]  to resolve 1 vulnerability
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Code Injection                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ morgan                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ morgan                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ morgan                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/736                             │
└───────────────┴──────────────────────────────────────────────────────────────┘


# Run  npm install [email protected]  to resolve 2 vulnerabilities
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ mpath                                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ mongoose                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ mongoose > mpath                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/779                             │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ mongodb                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ mongoose                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ mongoose > mongodb                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1203                            │
└───────────────┴──────────────────────────────────────────────────────────────┘


# Run  npm install --save-dev [email protected]  to resolve 1 vulnerability
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ mem                                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ webpack [dev]                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ webpack > yargs > os-locale > mem                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1084                            │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hoek                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ passport-jwt                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ passport-jwt > jsonwebtoken > joi > hoek                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/566                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ hoek                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ passport-jwt                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ passport-jwt > jsonwebtoken > joi > topo > hoek              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/566                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ braces                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=2.3.1                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ babel-cli [dev]                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ babel-cli > chokidar > anymatch > micromatch > braces        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/786                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 7 vulnerabilities (2 low, 4 moderate, 1 high) in 7075 scanned packages
  run `npm audit fix` to fix 3 of them.
  1 vulnerability requires semver-major dependency updates.
  3 vulnerabilities require manual review. See the full report for details.

I understand these are not your vulnerabilities, but it is probably likely that folks needing to use someone else's starter project also lack the knowledge & skill to resolve these vulnerabilities. Is it possible for you to revise this project to eliminate these concerns?

Thanks for sharing this code! ☕

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.