• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Hello world - intro to node js
 

Hello world - intro to node js

on

  • 622 views

Jeff Andersen from GoInstant ...

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.

Statistics

Views

Total Views
622
Views on SlideShare
622
Embed Views
0

Actions

Likes
0
Downloads
13
Comments
0

0 Embeds 0

No embeds

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

    Hello world - intro to node js Hello world - intro to node js Presentation Transcript

    • 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 Google’s v8 JavaScript engine • Event-driven, non-blocking (asynchronous) I/O
    • Who uses it?
    • 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
    • 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.5 million downloads per day • package.json
    • Package.json
    • npm install
    • 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
    • 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-featured router • • body parser, url parameters, query string parsing Automatic response formatting
    • Same functionality
    • Let’s code
    • 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
    • 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