Node.js

#tooling

yarn add -g prettyjson

https://npmcompare.com/compare/jsontool,prettyprint

#yarn vs npm

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

#ORM

#nvm

nvm ls nvm use system

#gitignore

node_modules

#package.json

Environment variables are passed into the scripts.

This can be tested via:

{
  scripts: {
    "env": "env | grep NODE"
  }
}

Run

yarn run env
NODE_ENV=production yarn run env

#express

  DEBUG=express:* yarn start
  DEBUG=express-start yarn start
  DEBUG=knex:* yarn start
  DEBUG=knex:query yarn start
  DEBUG=knex:tx yarn start

https://github.com/node-inspector/node-inspector

#Strings

https://stackoverflow.com/questions/16293923/does-v8-have-unicode-support https://github.com/v8/v8/blob/master/include/v8.h

https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings https://nodejs.org/dist/latest-v4.x/docs/api/buffer.html#buffer_buffers_and_character_encodings

#Mocha

mocha -g 'grep patern for function' file

#grunt

grunt --tasks .

#Bootstrapping a project

brew install yarn
yarn add --dev babel-cli babel-preset-flow eslint flow-bin pre-commit
yarn run eslint -- --init
yarn run flow init

#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