Skip to content

KnowJS/day-one

Repository files navigation

Node.js for Devs - Getting Dangerous Fast!

  • Matt Walters | github:@mateodelnorte
  • Patrick Scott | github: @patrickleet

##Day 1 - Foundations


###9am - 10am : Getting Setup (For anyone who isn't yet)


###10am - 10:40am : Groking JavaScript


###10 min break


###10:50am - 11:30am : Groking Node


###11:15pm - 12:15pm : NPM and Modules

  • npm init, search, info, install (& -g), update, home
    • --save, --save-dev
    • semver
  • node_modules + echo "node_modules" >> .gitignore
  • Node.js module-making mantras (small, tested, single purpose, compose-able)
  • npm publish
  • Pro Tip: npm link
  • Pro Tip: how to re-use modules privately using github tarballs
  • Problem: Rewrite previous example using 'request'. Be sure you save its dependency in package.json

###12:15pm - 1:15pm : Lunch

  • lunchtime preview:
    • coffee-script in your applications
    • coffee-script in your modules

###1:15pm - 2:15pm - Common Core Modules

  • console, process, events, stream, http, util, child_process
  • events - on vs once, 'error' and 'uncaughtException'
  • streams! just like unix pipes, in code - readable, writeable, duplex, transform
  • Pro Tip: https://github.com/isaacs/readable-stream
  • Problems:
    • Copy curl implementation and update to use 'readable' event and read() method from stream api
    • Copy previous solution and change to use pipe() to automatically control back pressure.


###10 min break


###2:25pm - 4:00pm - Common Modules and Frameworks pt. 1

  • npm home express
  • npm home connect
  • npm home jade
  • npm home passport.js
  • npm home mongoose
  • Pro Tip: Navigating and learning to use modules - View the tests and examples!
    • learn connect and its usage inside express, by navigating express' node_modules
    • Note: Express 4.0 will not include middleware anymore. You'll need to include each in your package.json. This makes express, itself, and your apps more maintainable.

  • Problem: Create a simple express app that lets you log in via GitHub. Once logged in, display overly simple page showing GitHub account info.
    • To complete this, you'll need to create a GitHub application here and export environment variables for the appropriate values.
      • Or use the following values: GITHUB_CLIENT_ID=e653b683c801e699158d GITHUB_CLIENT_SECRET=04ed16d573dbc9b887a3ceca505937262c4a08fa GITHUB_CLIENT_CALLBACKURL=http://127.0.0.1:3000/auth/github/callback
      • You can supply these on the command line each time you start your app, or export them in your .bashrc, .bash_profile, .zprofile, etc.
    • For info on github auth, execute npm home passport-github
    • bonus: Save GitHub account into on User document via mongooses
  • More Learning: http://nodeschool.io/#expressworks
  • https://github.com/mcavage/node-restify

###10 min break


###4:10 - 5:20pm - Common Modules and Frameworks pt. 2

  • npm home request
  • npm home underscore (or lodash)
  • npm home async
  • npm home bluebird
  • npm home mocha
  • npm home armrest* open discussion
  • Pro Tip: Favor modules that do one thing well and consider how they will be used (and re-used) in different applications and in other modules
  • Pro Tip: npm home vasync

  • Problem: Update previous solution to use the 'gm' module to resize an uploaded image and return the result to the user.
    • bonus 1: Save the uploaded image to the filesystem or a database
    • bonus 2: Return three different resized sizes of the uploaded image. Use bluebird or async to manage flow control
  • More Learning: http://nodeschool.io/#asyncyou

###(Stretch) 5:20 - 6:00 - Deployment


###Day End Questions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published