Skip to content

Instantly share code, notes, and snippets.

@adityajoshi12
Created August 12, 2019 12:44
Show Gist options
  • Save adityajoshi12/9f72531b386c00f48258c2a0311792a1 to your computer and use it in GitHub Desktop.
Save adityajoshi12/9f72531b386c00f48258c2a0311792a1 to your computer and use it in GitHub Desktop.
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