Node js for beginners
-
Upload
arjun-sreekumar -
Category
Technology
-
view
591 -
download
3
Transcript of Node js for beginners
![Page 1: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/1.jpg)
S ArjunS4 BCAAmrita University,Kollam
![Page 2: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/2.jpg)
★ Javascript & the V8 Engine★ Intro to node js★ Features of Node js ★ Examples of Node js★ Node js in the industry★ How to install★ NPM★ Hello world★ Frameworks and Extensions★ Future learning★ References
What’s going to be covered?
![Page 3: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/3.jpg)
javascript● Browser side programming● Event handling on the client side● Adding interactivity to web pages
![Page 4: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/4.jpg)
Google v8javascript Engine
![Page 5: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/5.jpg)
● v8 is a super fast javascript library built by google for chrome
● Compiles javascript directly into machine code instead of interpreting
● JIT(Just In Time ) compilation ● Written in c++
![Page 6: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/6.jpg)
what the js is node?● Node.js = javascript +google v8 on the
server● Additional features for javascript to run
on the server● Handle server side events● Cross operating system compatible
![Page 7: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/7.jpg)
What makes node better?
![Page 8: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/8.jpg)
Event driven● Just like javascript events on the client,Node
can handle various events on the server
● Examples of server events are,file transfer,request for a page,loading content from database
![Page 9: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/9.jpg)
![Page 10: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/10.jpg)
Non blocking I/O● Traditional applications waits for a set code to
complete before it displays the content.This is called blocking code
● in non blocking Once the request is made we continue on to the next line of code before waiting for the time consuming request to finish
● Uses callback functions to handle non blocking code
![Page 11: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/11.jpg)
Scalable● Node applications are highly scalable
● Horizontal scaling of servers
● Adding more servers instead of increasing the performance of each
![Page 12: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/12.jpg)
![Page 13: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/13.jpg)
what we can make with node?● Real time chat applications
● Upload huge amounts of data
● Data streaming applications
● Distributed ,clustered systems and embedded systems
● Applications that can handle millions of concurrent connections .
● Control Robots and drones through WLAN
![Page 14: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/14.jpg)
who uses node.js
And many more...
![Page 15: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/15.jpg)
A little bit of History ● Node.js was invented in 2009 by Ryan
Dahl● inspired to create Node.js after seeing a
file upload progress bar on Flickr● Opensource,sponsored by Joyent and
microsoft● Ryan was a mathematics student and
dropped out of college.
![Page 16: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/16.jpg)
Installing node.js
● for windows download the exe https://nodejs.org/download/
● On linux just type sudo apt-get install nodejs
sudo apt-get install npm
![Page 17: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/17.jpg)
NPM node package manager● Node package manager(NPM) is a component of
node js
● NPM fetches packages just like apt-get in ubuntu
● Packages are plugins or commonly used modules that add more functions to node.Just like beans in java
● NPM manages the dependency of the packages.
![Page 18: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/18.jpg)
HELLO world!var http = require('http');
http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); console.log("The server just go a request"); res.write("Hello world"); res.end();}).listen(9615);
![Page 19: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/19.jpg)
FRAMEWORKS & EXTENSIONS
● Express.js web application framework similar to python django or ruby on rails
● Cyclon.js Building WLAN/internet controlled robots and drones using node.js
● Sails.js MVC web application frameworks
● Socketstream Real Time applications .
![Page 20: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/20.jpg)
Moving ahead!
● The best way to learn node is to use and interactive tutorial called nodeschool
● Available as an Npm package : npm install -g learnyounode
● Official node.js documentation
![Page 21: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/21.jpg)
References● Official Node.js Documentation
● Nodeschool.io
● Wikipedia
● Node.js presentation by Gabriele Lana
● Toptal.com,code.tutsplus.com,Google developers
![Page 22: Node js for beginners](https://reader036.fdocuments.net/reader036/viewer/2022062302/58ecf83c1a28abbd078b4813/html5/thumbnails/22.jpg)
THANK YOU