Tell us what’s happening:
I have tried all solutions I found, but the submit always fails. Please help
Your code so far
TRIAL - 1
app.get(’/now’, function(req,res, next){
req.time = new Date().toString()
next();
}, function(req, res){
res.json({
‘time’: req.time
});
});
TRIAL - 2
app.get(’/now’, function(req,res, next){
next();
}, function(req, res){
var time = new Date()
console.log(‘time’+time);
res.json({‘time’: time});
}
);
…
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
.
Challenge: Chain Middleware to Create a Time Server
Link to the challenge: