Node.JS

Post on 14-Jun-2015

760 views 2 download

description

BackToSchool @ True Vision

Transcript of Node.JS

Node.JS Server side javascript

Intro

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

Use cases

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

something

Differences from Web browser

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

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

Programming paradigm

Non blocking operations Functional programming

Lazy – doing only when needed Event based

Do something when something happens

Example

HTTP server, which serves movie.avi from

current directory

Modules

require(); exports functions and

variables from from files module.exports

callbacks

most common code construct

functions are variables

non-blocking “this” magick

– var self = this; trick

Thank you!