Im trying to handle an empty route parameter if a path is not specified , I would like to return a new date if the route param is empty. So far server is responding like this: Cannot GET /api/timestamp/
app.get("/api/timestamp/:date_string", function(req,res){
let dateString=req.params.date_string
if(!req.params.date_string){
dateString=new Date()
res.json({"unix": dateString.getTime(), "utc" : dateString.toUTCString()})
}
})
Currently the server is not responding with a json new date as expected, anyone knows how to catch an empty route param?