node js for beginners

22
S Arjun S4 BCA Amrita University,Kollam

Upload: arjun-sreekumar

Post on 11-Apr-2017

585 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Node js for beginners

S ArjunS4 BCAAmrita University,Kollam

Page 2: Node js for beginners

★ 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

javascript● Browser side programming● Event handling on the client side● Adding interactivity to web pages

Page 4: Node js for beginners

Google v8javascript Engine

Page 5: Node js for beginners

● 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

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

What makes node better?

Page 8: Node js for beginners

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
Page 10: Node js for beginners

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

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
Page 13: Node js for beginners

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

who uses node.js

And many more...

Page 15: Node js for beginners

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

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

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

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

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

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

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

THANK YOU