var express = require('express')
var app = express()
var d=new Date()
var requestTime = function (req, res, next) {
req.requestTime = d.toLocaleString()
next()
}
app.use(requestTime)
app.get('/', function (req, res) {
var responseText = ''
responseText += '<small>Requested at: ' + req.requestTime + '</small>'
res.send(responseText)
})
app.listen(3000)
console.log('server started')
explain
Answers
Answered by
0
Answer:
first taking an var and declared that
then requested to have app brake
app get library used here then called function
Similar questions