• Like
  • Save
Introduction to Node.js
Upcoming SlideShare
Loading in...5
×
 

Introduction to Node.js

on

  • 909 views

 

Statistics

Views

Total Views
909
Views on SlideShare
788
Embed Views
121

Actions

Likes
0
Downloads
13
Comments
0

20 Embeds 121

http://therockncoder.blogspot.com 65
http://therockncoder.blogspot.co.uk 11
http://therockncoder.blogspot.de 8
http://therockncoder.blogspot.in 7
http://therockncoder.blogspot.fr 5
http://therockncoder.blogspot.ca 4
http://therockncoder.blogspot.com.br 4
http://therockncoder.blogspot.com.ar 2
http://therockncoder.blogspot.com.au 2
http://therockncoder.blogspot.nl 2
http://therockncoder.blogspot.mx 2
http://therockncoder.blogspot.be 1
http://therockncoder.blogspot.se 1
http://therockncoder.blogspot.hu 1
http://therockncoder.blogspot.com.es 1
http://therockncoder.blogspot.it 1
http://therockncoder.blogspot.no 1
http://therockncoder.blogspot.ro 1
http://therockncoder.blogspot.fi 1
http://therockncoder.blogspot.co.il 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introduction to Node.js Introduction to Node.js Presentation Transcript

    • Introduction to Node.js Please rate this talk: http://spkr8.com/t/19141Monday, January 14, 13
    • Our Goals • What Node Isnt and Is • A Website • How to Install • A RESTful Web Service • Hello World - Node • Why Node Style • Resources • Node Workflow • Summary • Three Key Ideas • Introducing NPMMonday, January 14, 13
    • Disclaimer The opinions expressed in this talk are my own and don’t represent those of my employer, my friends, my family, or even me.Monday, January 14, 13
    • Who am I? I am a Microsoft Certified Solution Developer and I’ve been developing software since 1979. Since 2009, I have been focused on developing mobile applications, for  iPhone, Android, the mobile web, and Windows Phone 7.Monday, January 14, 13
    • Who Are You? (I hope) • Experienced with JavaScript • Experience with some other server framework • Familiar with the Unix Tool Chain • Familiar with GitMonday, January 14, 13
    • What Node Isnt and Is? • What Node Isnt? • What Node Is? • How to Spell It?Monday, January 14, 13
    • What Node Isnt?Monday, January 14, 13
    • What Node Is? • The Official Answer • It is built on Googles V8 • The Server and the App Are OneMonday, January 14, 13
    • The Official Answer • Node.js is a platform built on Chromes JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.Monday, January 14, 13
    • It is built on Googles V8 • Google’s Open Source JavaScript Engine • V8 is really fast • It is compiled, sort ofMonday, January 14, 13
    • The Server and The App Are One • Unlike Other Technologies • IIS and ASP.NET ( aspnet_wp.exe) • Apache HTTP and PHP • Complete Control of the HTTP RequestMonday, January 14, 13
    • How to Spell It? • Node.js • Node.JS • Node (my preferred spelling)Monday, January 14, 13
    • How to Install • http://nodejs.org/downloads • Mac/PC/Linux/SunOS • Azure • http://www.windowsazure.com/en-us/ develop/nodejs/Monday, January 14, 13
    • Hello World Node Style var http=require(http); http.createServer(function (req, res) { res.writeHead(200, { Content-Type: text/plain}); res.end(Hello Worldn); }).listen(3000); console.log(Server running at http://localhost:3000/);Monday, January 14, 13
    • A Slightly Better Hello World var http=require(http); var server = http.createServer(); server.on(function (req, res) { res.writeHead(200, { Content-Type: text/plain}); res.end(Hello Worldn); }).listen(3000); console.log(Server running at http://localhost:3000/);Monday, January 14, 13
    • Node Workflow • The REPL • Developing • PublishingMonday, January 14, 13
    • The REPL • Read - Eval - Print Loop • Brings JavaScript to the command line • Allows all JavaScript commands • Isn’t Really too usefulMonday, January 14, 13
    • Developing • Text Editor / Terminal • VIM • WebStormMonday, January 14, 13
    • Publishing with Git • Git • Microsoft Azure • HerokuMonday, January 14, 13
    • Three Key Ideas • Callbacks • Events • ModulesMonday, January 14, 13
    • Callbacks • Callbacks are the key to Asynchronous Programming • Avoid thinking in Java or C# with callbacks query(“SELECT * from db”, function(result) { /* do something with result */ });Monday, January 14, 13
    • Events • Events are Core to Node’s Architecture • Events are defined in the Module, Events • Events are hooked using .on • Events are triggered using .emit • Your code can define and emit events alsoMonday, January 14, 13
    • Modules • Based on CommonJS • Solves the Issue of the JavaScript Global Object • Modules are wrapped in anonymous functionsMonday, January 14, 13
    • Modules (function() { /* contents of module file */ })();Monday, January 14, 13
    • Introducing NPM • Node Package Manager • http://npmjs.org • Core • Userland • Types of Installs • Don’t Re-invent the WheelMonday, January 14, 13
    • Core • Packages that are internal to Node • Defined in Nodes source in the lib/ folder • Modules like: http, util, fs, etc.Monday, January 14, 13
    • Userland • Modules loaded from NPM or other • npm install <module name> • npm install -g <module name>Monday, January 14, 13
    • Types of Installs • Global - Accessible to all Node Apps • Local - Accessible only to the current App • Prefer Local • App has all components when published • No need to sudoMonday, January 14, 13
    • Don’t Re-invent the Wheel • There are over 20k Packages already defined • Most of your problems have already been solvedMonday, January 14, 13
    • Top Ten Packages • #10 connect Connect is an extensible HTTP server framework for node, providing high performance "plugins" known as middleware. Connect is bundled with over 20 commonly used middleware, including a logger, session support, cookie parser, and more.Monday, January 14, 13
    • Top Ten Packages • #9 coffee-script CoffeeScript is a little language that compiles into JavaScript.Monday, January 14, 13
    • Top Ten Packages • #8 underscore Underscore.js is a utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...) without extending any core JavaScript objects.Monday, January 14, 13
    • Top Ten Packages • #7 jade Jade is a high performance template engine heavily influenced by Haml and implemented with JavaScript for node.Monday, January 14, 13
    • Top Ten Packages • #6 redis This is a complete Redis client for node.js. It supports all Redis commands, including many recently added commands like EVAL from experimental Redis server branches.Monday, January 14, 13
    • Top Ten Packages • #5 mocha Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser.Monday, January 14, 13
    • Top Ten Packages • #4 socket.io Socket.IO is a Node.JS project that makes WebSockets and realtime possible in all browsers. It also enhances WebSockets by providing built-in multiplexing, horizontal scalability, automatic JSON encoding/ decoding, and more.Monday, January 14, 13
    • Top Ten Packages • #3 async Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use with node.js, it can also be used directly in the browser.Monday, January 14, 13
    • Top Ten Packages • #2 request Simplified HTTP request client.Monday, January 14, 13
    • Top Ten Packages • #1 Express Fast, unopinionated, minimalist web framework for node.Monday, January 14, 13
    • A WebsiteMonday, January 14, 13
    • A RESTful Web ServiceMonday, January 14, 13
    • Why Node? • Avoids the Web Dev Context Switch • Gives You Full Control of the Server • Makes Asynchronous Coding Easy • Node is FunMonday, January 14, 13
    • Resources • http://nodejs.org • http://npmjs.org • http://nodetuts.com • http://howtonode.org • http://package.json.nodejitsu.comMonday, January 14, 13
    • Summary • What Node Isnt and Is • A Website Using Packages • How to Install • A RESTful Web Service • Hello World - Node Style • Why Node • Node Workflow • Resources • Three Key Ideas • Summary • Introducing NPMMonday, January 14, 13