Created
August 12, 2019 12:44
-
-
Save adityajoshi12/9f72531b386c00f48258c2a0311792a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express() | |
var requestTime = function (req, res, next) { | |
req.requestTime = Date.now() | |
next() | |
} | |
app.use(requestTime) | |
app.get('/', function (req, res) { | |
var responseText = 'Hello World!<br>' | |
responseText += '<small>Requested at: ' + req.requestTime + '</small>' | |
res.send(responseText) | |
}) | |
app.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment