Your SlideShare is downloading. ×
0
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
What is Node.js
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

What is Node.js

1,460

Published on

This is a simple presentation about Node.js

This is a simple presentation about Node.js

Published in: Education, Technology
1 Comment
6 Likes
Statistics
Notes
No Downloads
Views
Total Views
1,460
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
93
Comments
1
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Node .js
  • 2. WHO AM I ? • An Engineering Student at the International Institute of Technology • Node.js Developer • Article Writer at CodeProject.com
  • 3. What is Node? • A powerful platform to let you run JS on the server side • How? Uses Google’s V8 Engine • V8 is built in C • V8 is the fatest JS Engine on the planet • Great way to build modern web apps on both Client and Server side!
  • 4. What Can I Do in Node? • Anything you want! • Chat servers, Analytics & Crazy fast backends • Socket.io library is a wicked way to build real time apps • Build a social Network! LinkedIn, Dropbox all using Node.js
  • 5. What Can’t I Do in Node? • Contradicts previous slide but  Node.js is not a web framework i.e Sinatra Modules for node.js make it into web framework i.e Express Node.js is not Multi-threaded  A single thread to rule them all
  • 6. Non-Blocking? Blocking? I’m so confused • By introducing callbacks. Node can move on to other requests and whenever the callback is called, node will process is. • You should read non-blocking code as « put function and params in queue and fire callback when you reach the end of the queue » • Blocking= return Non-Blocking= no return. Only callbacks
  • 7. Node.js runs on the event loop • The event loop keeps on running. Checking for new events, so it can call callbacks for those events. • Lets take a look at an example.
  • 8. Event Loop Example var http = require('http'); http.createServer(function (request, response) { response.writeHead(200);// HTTP status response.write(‘Droidcon Tunisia') response.end(); }); server.listen(8080);
  • 9. Using Events • So we saw in our example, whenever an HTTP request event is fired,our callback is called. • Node.js has a LOT of events. Lots and Lots! • Lets see some in action.
  • 10. Events Example var http = require('http'); http.createServer(); server.on(‘request’,function(request,response) { response.writeHead(200);// HTTP status response.write(‘Droidcon Tunisia') response.end(); }); Server.on(‘connection’,function(socket){ Console.log(‘New Connection’); }); server.listen(8080);
  • 11. Using Modules • You might have noticed we’ve been using require(‘ ’) a lot. • Require is basically a way to import modules to your application. Modules are basically classes. • They are a module of code that contain functions which have been exported. • Exported functions are basically public.
  • 12. Using Modules • What does require return then? The file ? • Well no, when you require a module.It returns a JS Object. In require(‘http’) it return the HTTP object. • This has functions you can call,as well as public variables
  • 13. Thank you hadrichmed@gmail.com

×