Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Step Into World of NodeJS

Avatar for Hiren Dave Hiren Dave
February 20, 2021

Step Into World of NodeJS

Step Into World of NodeJS

Avatar for Hiren Dave

Hiren Dave

February 20, 2021
Tweet

More Decks by Hiren Dave

Other Decks in Technology

Transcript

  1. About Me Hiren Dave “I am a programmer and I

    will not fix your PC” Programmer & Tech Author, Blogger and Speaker Co-Organizer, GDG Ahmedabad, Laravel Live Ahmedabad
  2. Session Agenda • NodeJS Introduction • Understand NPM and Install

    NodeJs • Let’s bust some myths about NodeJs? • What you can build with NodeJs • Hello World NodeJs • Introduction to core modules of NodeJs • Create NodeJS module • API development with NodeJs • NodeJs WebSocket • NodeJs Database Connection • Machine Learning with NodeJs • Q & A
  3. NodeJs Introduction • NodeJs is open source • It’s cross

    platform run time environment • Specifically used for developing server side web applications and Networking Applications • NodeJS uses event driven non blocking I/O model
  4. Let’s understand Non Blocking I/O Model //Blocking Model console.log(“Prepare to

    get data set 1”); fetchDataSet1(params); console.log(“Prepare to get data set 2”) fetchDataSet2(params); console.log(“Prepare to get data set 3”) fetchDataSet3(params);
  5. Let’s understand Non Blocking I/O Model //How NodeJs Overcome it.

    console.log(“Prepare to get data set 1”); fetchDataSet1(params, function(){ console.log(“Data set 1 is available”) }); console.log(“Prepare to get data set 2”) fetchDataSet2(params, function(){ console.log(“Data set 2 is available”) }); console.log(“Prepare to get data set 3”) fetchDataSet3(params, function(){ console.log(“Data set 3 is available”) });
  6. Understand NPM and Install NodeJs • NPM is world’s largest

    software registry • NPM is free • It’s sole purpose is open source contribution • NPM is part of NodeJS installation Download it from official Website https://nodejs.org
  7. Understand NPM and Install NodeJs • NPM is world’s largest

    software registry • NPM is free • It’s sole purpose is open source contribution • NPM is part of NodeJS installation Download it from official Website https://nodejs.org
  8. Lets bust some myths about NodeJs • NodeJs can only

    be used to make chat applications • NodeJs is not secure • NodeJs is slow • NodeJs is not suitable for making scalable applications
  9. What you can build with NodeJs • Real time chat

    / network applications • Data (Audio / Video) streaming applications • Applications to handle concurrent requests • APIs for web applications • Microservices • Proxy servers • ML models
  10. Hello World NodeJs var http = require('http'); http.createServer(function (req, res)

    { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello NodeJs!'); }).listen(8000);
  11. Create NodeJs Module > mkdir myModule > cd myModule >

    npm init -y > nano index.js > node > date = require(./index)
  12. Api Development NodeJs and Express > mkdir api > cd

    api > npm install -g express-generator > npm install express --save > nano index.js
  13. NodeJs WebSocket > mkdir socket > cd socket > nano

    index.js > nano client.js > npm install websocket
  14. Machine Learning with NodeJs > mkdir ml > cd ml

    > nano index.js > npm install @tensorflow/tfjs > npm install @tensorflow/tfjs-node
  15. Being a NodeJs Developer • Only NodeJs Development • MEAN

    Stack (MongoDB + Express + Angular + NodeJs) • MERN Stack (MongoDB + Express + ReactJs + NodeJs) • NodeJS + Serverless (AWS Lambda)
  16. NodeJs Frameworks • Express • Socket.io • Nest.js • Hapi.js

    • Koa.js • Meteor.js • Sails.js • PM2