Introduction to Node.js Andrew Lively Co-op Student CECH IT - - PowerPoint PPT Presentation

introduction to node js
SMART_READER_LITE
LIVE PREVIEW

Introduction to Node.js Andrew Lively Co-op Student CECH IT - - PowerPoint PPT Presentation

Introduction to Node.js Andrew Lively Co-op Student CECH IT Solutions Center What is Node.js Server-side JavaScript finally done right Based on Googles V8 engine Event-driven I/O Model Highly Scalable What Can You


slide-1
SLIDE 1

Introduction to Node.js

Andrew Lively Co-op Student CECH IT Solutions Center

slide-2
SLIDE 2

What is Node.js

  • “Server-side JavaScript finally done right”
  • Based on Google’s V8 engine
  • Event-driven I/O Model
  • Highly Scalable
slide-3
SLIDE 3

What Can You Do With Node.js

  • Web Applications

– Real-time applications – Event-based web sites

  • REST Web Services
  • iOS/Android
  • Desktop Applications

– Linux/Windows/OS X

slide-4
SLIDE 4

Who Uses Node.js

  • Dow Jones
  • eBay
  • LinkedIn
  • Microsoft
  • Pearson
  • Yahoo
  • Many more…
slide-5
SLIDE 5

How To Install

  • http://nodejs.org/download/
  • Windows

– Executable and installer

  • Homebrew on OS X

– brew install node

  • Linux

– https://github.com/joyent/node/wiki/Installing- Node.js-via-package-manager

slide-6
SLIDE 6

Basic Commands

  • node

– Starts node console – node <.js filename> – node –v

  • npm
  • Node package manager
  • npm -v
slide-7
SLIDE 7

“Hello, World!”

Simple “Hello World”: console.log(“Hello, World!”);

slide-8
SLIDE 8

Web “Hello, World!”

var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello, World!\n"); }).listen(8000); console.log("Server running at http://127.0.0.1:8000/");

slide-9
SLIDE 9

Popular Modules

  • Express

– Web application framework

  • Socket.io

– Helps make real-time applications

  • Mongoose

– MongoDB Object Modeling

  • Jade

– Template engine

  • restify

– REST API framework