Express.js

Ryan Tucker

who am I?

Full-Stack Web Developer at ASTi

  • AngularJS
  • NodeJS
  • Express
  • Python

What is Express?

"Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications."

what's this mean?

  • Express is an abstraction on top of NodeJS to simplify the development of many types of web apps.
  • Easy to download through NPM.
  • Great for doing things like RESTful APIs.

what's built in?

  • As of version 4.0 less, but many things were pulled out into official middleware packages.
  • Easily handle different HTTP requests (GET, PUT, POST, DELETE, etc).
  • Ability to serve static content.

what about the other modules?

  • HTTP request body parsing
  • Compression
  • Sessions


Really just common tasks for a webserver.

what pairs well with express?


Many people like using Nginx to handle static content and as a proxy in front of an Express app.

Nginx is a standalone webserver/proxy that runs many major websites on the Internet.

Alternatives?

Most of these are large opinionated frameworks.

  • Flatiron
  • Koa
  • Restify
  • Sails.js
  • Hapi.js

How do i use it?

var express = require('express');
var app = express();

// Configure some routes
app.route('/hello)
  .get(function(req, res, next) {
    res.send('world!'); 
  })
  .post(function(req, res, next) {
    console.log('we got a post!'); 
  });

// Give it the port to listen to
app.listen(8080);

questions?


E-mail me at rtucker88@gmail.com

Express.js

By Ryan Tucker