Skip to content

Instantly share code, notes, and snippets.

@cmilfont
Last active May 4, 2020 03:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmilfont/747f52d12713b290fc099069a744983b to your computer and use it in GitHub Desktop.
Save cmilfont/747f52d12713b290fc099069a744983b to your computer and use it in GitHub Desktop.
Guideline NodeJS

Continuous Delivery

Deployment Tool

Ship it

PM2 deployment

Process Manager

PM2

Continuous Integration

Logging

morgan: HTTP request logger middleware for node.js

winston: a multi-transport async logging library for node.js

Exemplo de configuração com o Logentries

Development

Environment Variables

Dotenv

yarn add dotend

Inclua no início do código

require('dotenv').config();

Coloque seu .env no .gitignore, o dotenv ignora caso não exista.

Cache

Redis

yarn add redis connect-redis

Configura seu express-session para utilizar o connect-redis.

Debug

https://nodejs.org/api/debugger.html

  1. Configura em ecosystem.config.js
  2. Execute yarn start:dev
  3. Abra no Chrome chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/009eb69b-7cef-4727-8889-985bf46bbb0b

Language

Guideline to Javascript language

Compatibility table to nodejs

Mindset to working with NodeJS

Nodejs and ExpressJS good patterns

Checklist: Node.JS production best practices

Scaling Nodejs Applications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment