I have a timeout error trying to pass this challenge here is my code so far in app.js:
var express = require('express');
var app = express();
app.use(function(req, res, next) {
console.log(`${req.method} ${req.path} - ${req.ip}`);
next();
})
app.get('/', function (req, res){
res.send('Hello Express')
});
app.get('/hi', function (req, res){
var absolutePath = __dirname + '/views/index.html'
res.sendFile(absolutePath);
});
app.use(express.static(__dirname + '/public'));
process.env.MESSAGE_STYLE='uppercase';
app.get('/json', function (req,res){
let msg = "Hello json";
if (process.env.MESSAGE_STYLE==='uppercase') {
msg = msg.toUpperCase();
}
res.json({"message": msg})
});
// --> 7) Mount the Logger middleware here
app.get('/now', function (req, res, next){
req.time= new Date().toString()
}, function (req, res){
res.send({time: req.time})
})
this is the link im trying to serve:
https://happy-scorpion.glitch.me/now