Learning Node.js: A Hands-On Guide to Building Web Applications in JavaScript by Marc Wandschneider

Learning Node.js: A Hands-On Guide to Building Web Applications in JavaScript by Marc Wandschneider

Author:Marc Wandschneider [Wandschneider, Marc]
Language: eng
Format: azw3, epub, pdf
Publisher: Pearson Education
Published: 2016-12-23T05:00:00+00:00


hello world

Now, watch what happens if you move the responseTime middleware component to the end, as follows:

Click here to view code image

var express = require('express');

var app = express();

app.use(express.logger('dev'))

// move this to AFTER the next use() and see what happens!

.use(function(req, res){

res.end('hello world\n');

})

.use(express.responseTime())

.listen(8080);

Notice that the X-Response-Time header is gone!

Click here to view code image

HTTP/1.1 200 OK

X-Powered-By: Express

Date: Wed, 05 Dec 2012 04:14:05 GMT

Connection: keep-alive

Transfer-Encoding: chunked



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.