Node.JS

9

Click here to load reader

description

BackToSchool @ True Vision

Transcript of Node.JS

Page 1: Node.JS

Node.JS Server side javascript

Page 2: Node.JS

Intro

Good old javascript But server side Fully asynchronus “Buzz” technology

Page 3: Node.JS

Use cases

Real time web applications Messaging File download Anything that spends lot of time waiting for

something

Page 4: Node.JS

Differences from Web browser

CommonJS – http://wiki.commonjs.com Modules

Npm – http://www.npmjs.org File system, external process and network API

Page 5: Node.JS

Programming paradigm

Non blocking operations Functional programming

Lazy – doing only when needed Event based

Do something when something happens

Page 6: Node.JS

Example

HTTP server, which serves movie.avi from

current directory

Page 7: Node.JS

Modules

require(); exports functions and

variables from from files module.exports

Page 8: Node.JS

callbacks

most common code construct

functions are variables

non-blocking “this” magick

– var self = this; trick

Page 9: Node.JS

Thank you!