GithubHelp home page GithubHelp logo

victorserpac / node-es6-seed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from herbstrith/node-es6-seed

0.0 2.0 0.0 178 KB

Seed project created to serve as a starting point for new projects, suggesting some patterns, dependencies/packages and style guide.

Home Page: http://www.4all.com

License: MIT License

Dockerfile 1.51% JavaScript 98.49%

node-es6-seed's Introduction

node-es6-seed Build Status Coverage Status Known Vulnerabilities Dependency Status

Seed project created to serve as a starting point for new projects, suggesting some patterns, dependencies/packages and style guide.

Stack

Responsability What
JS Spec ES6
Process Managament PM2
Code Standard ESLint
Logs Winston
HTTP Headers Helmet
Test Runner Mocha
DB knex
CORS CORS
Body Parsing Body Parser
Versioning SemVer

Installing and running the app with PM2

$ npm install
$ npm install -g pm2
$ npm start

Running in dev with nodemon

$ npm install
$ npm install -g nodemon
$ npm run dev

Docker

# Build image
$ docker build -t <your username>/xablau .

# List images
$ docker images

# Run images
$ docker run -p 49160:3000 -d <your username>/xablau

# Get container id
$ docker ps

# App output
$ docker logs <container id>

# Run commands inside the container
$ docker exec -it <container id> /bin/bash

PM2

Running PM2 on server boots

$ pm2 startup systemd

PM2 Cheat Sheet

$ systemctl status pm2 (pm2 status)
$ pm2 stop app_name_or_id (stop app)
$ pm2 restart app_name_or_id (restart app)
$ pm2 list (list apps)
$ pm2 info example (specific info about an app)
$ pm2 monit (open pm2 monitor)
$ pm2 logs -h (display option for pm2 logs command)
$ pm2 logs (display all apps logs)
$ pm2 logs api (display only api app logs)
$ pm2 logs big-api --lines 1000 (display X lines of api log file)

Logs

$ cd $HOME/.pm2/logs

ESLint

$ npm install eslint --save-dev
$ ./node_modules/.bin/eslint src/

NSP

Command-line tool that checks the Node Security Project vulnerability database to determine if your application uses packages with known vulnerabilities. Install it as follows:

$ npm i nsp -g
$ nsp check

Additional security considerations

Here are some further recommendations from the excellent Node.js Security Checklist. Refer to that blog post for all the details on these recommendations:

  • Implement rate-limiting to prevent brute-force attacks against authentication.
  • Use csurf middleware to protect against cross-site request forgery (CSRF).
  • Always filter and sanitize user input to protect against cross-site scripting (XSS) and command injection attacks.
  • Defend against SQL injection attacks by using parameterized queries or prepared statements.
  • Use the open-source sqlmap tool to detect SQL injection vulnerabilities in your app.
  • Use the nmap and sslyze tools to test the configuration of your SSL ciphers, keys, and renegotiation as well as the validity of your certificate.
  • Use safe-regex to ensure your regular expressions are not susceptible to regular expression denial of service attacks.

node-es6-seed's People

Contributors

arielril avatar diogoazevedos avatar gmenti avatar henrique502 avatar luanmotta avatar moog avatar thrcorrea avatar ulymarins avatar

Watchers

 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.