June 2013
Intermediate to advanced
236 pages
4h 33m
English
From the examples in Chapter 1, What is Express? and Chapter 2, Your First Express App, we know how routes and route handler callback functions look like. Here is an example to refresh your memory:
app.get('/', function(req, res) {
res.send('welcome');
});Routes in Express are created using methods named after HTTP verbs. For instance, in the previous example, we created a route to handle GET requests to the root of the website. You have a corresponding method on the app object for all the HTTP verbs listed earlier.
Let's create a sample application to see if all the HTTP verbs are actually available as methods in the app object:
var http = require('http'); var express = require('express'); var app = express(); // Include ...Read now
Unlock full access