Sunteți pe pagina 1din 131

NodeJS

Tjiu Suryanto
Rev. 0ct 01, 2013

BorneviaCRM

NodeJS
Introduction Basic Flow control ExpressJS (web server) Comet (real time push)

NodeJS = Node.js

NodeJS can be used for...

Database

Home Automation

Robot Controller

Getting NodeJS

Getting it (from source)

Getting it (packaged)

NodeJS Basics

Demo Time!

Demo 1

Cooool! But now what????

NodeJS is NOT a framework


It's a JS interpreter!

In order to unleash its full potential, we need to include modules

Just like the ol' times

How?

Getting NPM (source)

Getting NPM (automated installer)

Callback Hell

Query 1

Query 2

Query 3

Do something useful

Chrismas tree code

Meet async

async

Getting async

$ npm install async

............that's it!

It's Time for a Demo!

Demo 2

Now..... Whenever you have a bunch of IO calls

Async :)

NodeJS Web Development

Demo!

Demo 3

Demo!

Demo 4

Let's See How it Works (Demo)

Demo 5

Comet

Initialization

Core app

Socket.io Demo

Demo 6

Bonus! NodeJS + Android

Android Location Tracker

3 1 3

2 3

DEMO

Demo 7

ANY QUESTIONS???