0
HELLO WORLD
Jeff Andersen
Developer
Twitter: @jeffandersen
Email: jeff@goinstant.com
What is Node.js?
•

In a nutshell: server-side JavaScript

•

Used to build scalable network applications

•

Built on Goo...
Who uses it?
Installing Node.js
•

Visit nodejs.org

•

Download the package/installer and run

•

Alternatively: use nvm - Node Versio...
Test out the repl
•

From the command line type `node`

•

Type out commands and hit enter
Use cases
•

REST APIs

•

Streaming data

•

High concurrency

•

Leveraging UNIX tools

•

Realtime applications
Event Driven
Event Driven
Sync vs Async
Synchronous
(Blocking)
Asynchronous
(Non-Blocking)
Asynchronous
(Non-Blocking)
•

Node is built for async i/o

•

Sometimes difficult to understand

•

Callback soup
Let’s run it
HTTP Server
5 lines of code
Let’s run it
HTTP Server
Community / Ecosystem

http://notinventedhe.re/on/2011-7-26
•

npmjs.org

•

Open source software

•

Official package manager for Node.js

•

Nearly 55 thousand packages and almost 2...
Package.json
npm install
Recommended Modules
•

async - Higher-order functions and common patterns for
asynchronous code

•

lodash - A utility lib...
Example app
Example app
Basic REST api
What do we need?
•

HTTP server

•

Postgres database

•

Postgres client

•

JSON formatted responses
We have an HTTP server
Problems?
•

One handler replying to every request

•

Missing
•

Routing/URL parameters

•

Response formatting
Introducing Express
•

npm install express

•

Sinatra style web framework

•

Simple verb-based request handlers

•

Full...
Same functionality
Let’s code
What could be added?
•

OAuth middleware
•

Middleware: A function that processes a request, typically on
an interim basis...
Twitter recommendations
•

@izs - Isaac Schlueter, Creator of NPM & Node core gate keeper

•

@eranhammer - Eran Hammer, W...
Hello world - intro to node js
Hello world - intro to node js
Hello world - intro to node js
Upcoming SlideShare
Loading in...5
×

Hello world - intro to node js

2,098

Published on

Jeff Andersen from GoInstant

Have you ever thought that writing web applications should allow you to use your mad Javascript skillz on the server side as well? Node.js is such a platform. Bundling up the Google Chrome Javascript runtime, Node lets you easily building fast and scalable network applications perfect for the real-time web. It's also a pretty great platform for building basic data driven websites too. Jeff, a web developer at Halifax based GoInstant, will introduce us to the Node platform, exploring it from the ground up.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,098
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Hello world - intro to node js"

  1. 1. HELLO WORLD
  2. 2. Jeff Andersen Developer Twitter: @jeffandersen Email: jeff@goinstant.com
  3. 3. What is Node.js? • In a nutshell: server-side JavaScript • Used to build scalable network applications • Built on Google’s v8 JavaScript engine • Event-driven, non-blocking (asynchronous) I/O
  4. 4. Who uses it?
  5. 5. Installing Node.js • Visit nodejs.org • Download the package/installer and run • Alternatively: use nvm - Node Version Manager
 (Similar to Ruby’s RVM)
 https://github.com/creationix/nvm
  6. 6. Test out the repl • From the command line type `node` • Type out commands and hit enter
  7. 7. Use cases • REST APIs • Streaming data • High concurrency • Leveraging UNIX tools • Realtime applications
  8. 8. Event Driven
  9. 9. Event Driven
  10. 10. Sync vs Async
  11. 11. Synchronous (Blocking)
  12. 12. Asynchronous (Non-Blocking)
  13. 13. Asynchronous (Non-Blocking) • Node is built for async i/o • Sometimes difficult to understand • Callback soup
  14. 14. Let’s run it
  15. 15. HTTP Server
  16. 16. 5 lines of code Let’s run it
  17. 17. HTTP Server
  18. 18. Community / Ecosystem http://notinventedhe.re/on/2011-7-26
  19. 19. • npmjs.org • Open source software • Official package manager for Node.js • Nearly 55 thousand packages and almost 2.5 million downloads per day • package.json
  20. 20. Package.json
  21. 21. npm install
  22. 22. Recommended Modules • async - Higher-order functions and common patterns for asynchronous code • lodash - A utility library delivering consistency, customization, performance, & extras. • express - Sinatra inspired web development framework • mocha - simple, flexible, fun test framework • pg - PostgreSQL client • redis - Redis client
  23. 23. Example app
  24. 24. Example app Basic REST api
  25. 25. What do we need? • HTTP server • Postgres database • Postgres client • JSON formatted responses
  26. 26. We have an HTTP server
  27. 27. Problems? • One handler replying to every request • Missing • Routing/URL parameters • Response formatting
  28. 28. Introducing Express • npm install express • Sinatra style web framework • Simple verb-based request handlers • Full-featured router • • body parser, url parameters, query string parsing Automatic response formatting
  29. 29. Same functionality
  30. 30. Let’s code
  31. 31. What could be added? • OAuth middleware • Middleware: A function that processes a request, typically on an interim basis to the final request handler. • Permissions & token scopes • JSON web hooks
  32. 32. Twitter recommendations • @izs - Isaac Schlueter, Creator of NPM & Node core gate keeper • @eranhammer - Eran Hammer, Walmart Labs & OSS contributor • @substack - James Halliday, Node module authoring machine • @tjholowaychuk - TJ Holowaychuk, Author: Express, Mocha, etc • @igrigorik - Ilya Grigorik, Developer advocate at Google • @jeresig - John Resig, Creator of jQuery • @goinstant - Realtime Collaboration API and Backend
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×