@vinaymavi

Agenda

* what is nodejs

* installation

* project creation

* dependency manger

   - npm

* package.json

   - scripts

   - depencencies

   - dev-depencencies

* npm registory

* package-lock.json 

Node-JS

What is compiler?

Compilation Phases

var msg = ":)";
print(msg)

Compilation

Execution

var msg = ":)";
print(msg)

Compiler

Runtime

Node-JS

V8 engine

Installation

Verification

Project Creation

Project Creatoin

##Name of file -  package.json

{
  "name": "temp_repo",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    
  }
}

package installation

Dependency Manger

package.json

##Name of file -  package.json

{
  "name": "temp_repo",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    
  }
}

NPM Registory

NPM Registory

package-lock.json

package-lock.json

{
  "name": "weback-training",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack --env production",
    "build:w": "webpack --env development --watch",
    "build:dev": "webpack --env development ",
    "start": "webpack-dev-server --env development"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/vinaymavi/weback-training.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/vinaymavi/weback-training/issues"
  },
  "homepage": "https://github.com/vinaymavi/weback-training#readme",
  "devDependencies": {
    "autoprefixer": "^8.5.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-preset-env": "^1.7.0",
    "css-loader": "^0.28.11",
    "file-loader": "^1.1.11",
    "html-webpack-plugin": "^3.2.0",
    "image-webpack-loader": "^4.2.0",
    "mini-css-extract-plugin": "^0.4.0",
    "node-sass": "^4.9.0",
    "postcss-loader": "^2.1.5",
    "sass-loader": "^7.0.1",
    "style-loader": "^0.21.0",
    "url-loader": "^1.0.1",
    "webpack": "^4.8.1",
    "webpack-cli": "^2.1.3",
    "webpack-dev-server": "^3.1.4",
    "webpack-merge": "^4.1.2"
  }
}

package-lock.json

package-lock.json

  • npm install dependencies from package-lock.json
    • if package.json file not updated
  • it helps to manage consistency throughout the machines 

Feedback

http://bit.ly/vm-nodejs

Q&A

Basic nodeJs project setup

By Vinay Mavi

Basic nodeJs project setup

This deck explain what is nodejs and how to setup a basic project.

  • 503