Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Node.js
JavaScript for Server Side / Standalone App
Overview
Standalone JS (w/o browser)
AWS Lambda
ExpressChrome V8 Engine
Ryan Dahl
Pay Pal, Uber, Yahoo!
Design of Node.js
Interpretor (V8)
WebSocket
Event Driven / Non Blocking IO
No Buffering Data
Not parallel but concurrent
Event Loop
L1/cache: 3 cycles
L2/cache: 14 cycles
RAM : 250 cycles
Disk : 41,000,000 cycles
Network : 240,000,000 cycles
2...
Hello World
> node hello.js
plz stay with me, just a ceremony…
HTTP Server
http.createServer(handler).listen(8081)
HTTP Client
http.request(server details, callback(response) {
response.on(‘data’, function(content) {
// work on the conte...
Callback
I will let you know when I am done. So continue your task plz. (Non blocking)
But, I won’t be able to work on it ...
Closure
Closures are useful to mimic objects that have instance variables.
Ex.) prevent users from double-clicking a submi...
Event Driven
EventEmitter.on(‘event’, callback) / emit(‘event’)
File I/O
read(file descriptor, buffer, offset, buffer size, file position, callback)
Express
require(‘express’)
Exec
require(‘child_process’).exec
MongoDB
MongoClient.connect()
db.collection(‘collection’).insertOne({data})
cursor = db.collection(‘collection’).find()
Socket.IO
socket.listen(server).on()
io.connect().on(‘chan’)
socket.broadcast.emit(‘chan’)
Run two browsers
Upcoming SlideShare
Loading in …5
×
Upcoming SlideShare
Entry doors the frontdoorco.com
Next
Download to read offline and view in fullscreen.

0

Share

Download to read offline

Node js

Download to read offline

Node.js

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Node js

  1. 1. Node.js JavaScript for Server Side / Standalone App
  2. 2. Overview Standalone JS (w/o browser) AWS Lambda ExpressChrome V8 Engine Ryan Dahl Pay Pal, Uber, Yahoo!
  3. 3. Design of Node.js Interpretor (V8) WebSocket Event Driven / Non Blocking IO No Buffering Data Not parallel but concurrent
  4. 4. Event Loop L1/cache: 3 cycles L2/cache: 14 cycles RAM : 250 cycles Disk : 41,000,000 cycles Network : 240,000,000 cycles 240,000,000 m = go around the earth 6 times So, CPU is not so busy. It could take on another task in the mean time.
  5. 5. Hello World > node hello.js plz stay with me, just a ceremony…
  6. 6. HTTP Server http.createServer(handler).listen(8081)
  7. 7. HTTP Client http.request(server details, callback(response) { response.on(‘data’, function(content) { // work on the content }
  8. 8. Callback I will let you know when I am done. So continue your task plz. (Non blocking) But, I won’t be able to work on it immediately. I will work on it once I am free. (Single thread)
  9. 9. Closure Closures are useful to mimic objects that have instance variables. Ex.) prevent users from double-clicking a submit button by setting a flag.
  10. 10. Event Driven EventEmitter.on(‘event’, callback) / emit(‘event’)
  11. 11. File I/O read(file descriptor, buffer, offset, buffer size, file position, callback)
  12. 12. Express require(‘express’)
  13. 13. Exec require(‘child_process’).exec
  14. 14. MongoDB MongoClient.connect() db.collection(‘collection’).insertOne({data}) cursor = db.collection(‘collection’).find()
  15. 15. Socket.IO socket.listen(server).on() io.connect().on(‘chan’) socket.broadcast.emit(‘chan’) Run two browsers

Node.js

Views

Total views

338

On Slideshare

0

From embeds

0

Number of embeds

3

Actions

Downloads

2

Shares

0

Comments

0

Likes

0

×