Node.js Developing - nomrand/__basics GitHub Wiki

Overview

Node.js Environment Overview

Environment

- Tool/Service
IDE Visual Studio Code
SCM Git (GitHub)
CI TravisCI
Testing Framework Jest
Deploy Heroku

appli url is https://XXXXAPP_NAMEXXXX.herokuapp.com/

Install

Create node.js files

npm init
npm install

or

express --view=pug myapp
cd myapp
npm install

'express myapp(express generator)' not tried. just use dirs.

Modules

ESLint

execute command below at apps dir.

npm install -g eslint
npm install -g eslint-plugin-jest
eslint --init 

then add setting to .eslintrc.js

"plugins": ["jest"]
....
"env": {
  "jest/globals": true
}

about https://www.npmjs.com/package/eslint-plugin-jest.

Visual Studio Code

Add-on

  • ESLint

Files

for ESLint

  • .eslintrc.js

rules and settings.

for Testing

  • jest.config.js

test setting (fist loaded js=jest-setup.js) & and other settings are set.

  • jest-setup.js

global env var set.

for CI

  • .travis.yml

settings. MUST CHANGE "app"

....
deploy:
  provider: heroku
  api_key: ${HEROKU_API_KEY}
  app: XXXXXX

and MUST BE SET HEROKU_API_KEY on Heroku.