Giter VIP home page Giter VIP logo

nodejs-for-devs's Introduction

node.js for devs


Get dangerous w/ Node in a day

Presenters: Matt Walters & Sahat Yalkabov

Today we will:

  • Get up and running with nvm/n, npm, Node.js and Express.
  • Learn fundamental Node and JavaScript concepts like callbacks, events, and promises.
  • Become familiar with some of Node's most popular modules and learn their benefits.
  • Bootstrap a site and API with the latest tools like yeoman, bower, and others.
  • Deploy your site to heroku or a cloud of your choice.

And more importantly:

  • Teach you where to look in order to more easily understand and learn Node on your own.

9am-9:30am: Getting Setup

(For anyone who isn't yet)


9:30am-10:15am: JavaScript Refresher

brief language overiew, callbacks, events, and promises


9:30am-10:15am: JavaScript Refresher


15 min break


10:30am - 11:15am: Groking Node


11:15am - 12:00pm: NPM and Modules


12:00pm - 1:00pm: Lunch


1:00pm - 1:45pm - Common Core Modules


1:00pm - 1:45pm - Common Core Modules


1:45pm - 3:00pm - Common Userland Modules

  • 'npm home express', connect, jade
  • 'npm home underscore' (or lodash), async, bluebird
  • 'npm home mocha', request, mongoose, passport.js
  • Pro Tip: Favor modules that do one thing, but do it well. Compose these modules into larger modules and solutions.
  • 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.

15 min break


1:55pm - 3:00pm - Common Userland Modules

Problem:

    1. Create a simple express app that lets you upload an image, which is then shown to the user. (To complete this you'll create a simple express site, add routes and views which present a form to a user and accept a multipart POST from the form.)
  • Bonus 1) use the 'gm' module to resize your images upon upload to save a thumbnail as well as original message.
  • Bonus 2) use the 'async' module to create three different sizes of your uploaded image.

More Learning:


3:00 - 3:45pm - Start Hacking


3:00 - 3:45pm - Start Hacking

Problems:

    1. Install yeoman, install the 'browserify' generator and generate a new site. Choose gulp when asked to do so. (if you have issues with SASS, redo and choose not to install when generating).
    1. Update the site you just created to make an ajax call back to the server. Do a GET request to a new route in your site and return a random word to the browser. When received in the browser, update the page to say Hello+Your_Word instead of 'Hello World'. Make the random-word-swap happen every time someone clicks the 'Learn more' button. User browserify to keep your code well organized.
    1. Separate your API from your site by creating a new express site and a proxy using http-proxy. Keep each in a separate folder and start each individually, on different ports. Use a regular expression to have your proxy direct all requests with a url including '/api' to the api, and all other requests to your site.

3:45pm - 4:00pm - Deploying to heroku

  • adding a Procfile
  • starting multiple executables

Problem:

  • create a Procfile, heroku create, git push heroku master

More Learning:


async: waterfall

async.waterfall([
  function(callback) {
    callback(null, 'one', 'two');
  },
  function(arg1, arg2, callback) {
    // Here arg1 is 'one' and arg2 is 'two'
    callback(null);
  },
], function(err, results) {
  // Optional callback when everything is finished
});

node.js: cluster

var os = require('os');
var cluster = require('cluster');

cluster.setupMaster({
  exec: 'app.js'
});

cluster.on('exit', function(worker) {
  console.log('Worker ' + worker.id + ' died');
  cluster.fork();
});

for (var i = 0; i < os.cpus().length; i++) {
  cluster.fork();
}

Express REST API

File Upload

CSRF Protection

nodejs-for-devs's People

Contributors

sahat avatar

Watchers

Pankesh Bamotra avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.