Node.js

tooling

1
yarn add -g prettyjson
Copied!

yarn vs npm

yarn
npm
yarn
npm install
yarn add package
npm -i -S package

ORM

nvm

1
nvm ls nvm use system
Copied!

gitignore

1
node_modules
Copied!

package.json

Environment variables are passed into the scripts.
This can be tested via:
1
{
2
scripts: {
3
"env": "env | grep NODE"
4
}
5
}
Copied!
Run
1
yarn run env
2
NODE_ENV=production yarn run env
Copied!

express

1
DEBUG=express:* yarn start
2
DEBUG=express-start yarn start
3
DEBUG=knex:* yarn start
4
DEBUG=knex:query yarn start
5
DEBUG=knex:tx yarn start
Copied!

Strings

Mocha

mocha -g 'grep patern for function' file

grunt

grunt --tasks .

Bootstrapping a project

1
brew install yarn
2
yarn add --dev babel-cli babel-preset-flow eslint flow-bin pre-commit
3
yarn run eslint -- --init
4
yarn run flow init
Copied!

Cons

  • No consistency in one app from another.

Server Side

  • Run latest ES code

Client Side

  • Transpile it to a version browsers can use
  • Has to use transpiled server side version

Support

version
Support
8.10
AWS Lamba Support
Last modified 2yr ago