- Prabhanshu Attri

  •  NodeJS is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side
  • NPM is a package manager for the JavaScript programming language

Few small companies using NodeJS

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
nvm --version

Install NVM (Node Version Manager)

nvm install 8.9.1
node --version
npm --version

Install Node

npm install --save express

Installing NPM packages

node index.js

Running Node

DEMO!

Deploying API on server

var express = require('express');
var app = express();

app.set('port', (process.env.PORT || 5000));

app.use(function(req, res, next) {
    console.log("User-agent: ", req.get('User-Agent'));
    next();
});

app.get('/', function(req, res) {
    res.json({
      'hello': 'friend!'
    });
});

app.listen(app.get('port'), function() {
    console.log('Node app is running on port', app.get('port'));
});

Thank you

@PrabhanshuAttri

prabhanshu.com

@PrabhanshuAttri

NPM install and chill

By Prabhanshu Attri

NPM install and chill

  • 231
Loading comments...

More from Prabhanshu Attri