I do not understand what the reason why is this is not passing all of the tests:
// index.js
// where your node app starts
// init project
var express = require('express');
var app = express();
let bodyParser=require('body-parser');
// enable CORS (https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)
// so that your API is remotely testable by FCC
var cors = require('cors');
app.use(cors({optionsSuccessStatus: 200})); // some legacy browsers choke on 204
// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'));
//it is to read different kind of information
app.use(bodyParser.urlencoded({extended: false}));
// http://expressjs.com/en/starter/basic-routing.html
app.get("/", function (req, res) {
res.sendFile(__dirname + '/views/index.html');
});
// your first API endpoint...
app.get("/api/hello", function (req, res) {
res.json({greeting: 'hello API'});
});
app.get("/api",function(req,res){
let utcCurrentTime = new Date().toUTCString();
let unixCurrentTime = Date.now();
res.json({unix:utcCurrentTime, utc: unixCurrentTime});
//res.json({unix:utcCurrentTime})
});
//fourth endpoint
app.get("/api/:date",function(req,res){
let date = parseInt(req.params.date);
if((Date.parse)){//if true, continues with the transformation
let seconds = new Date(date);
let utcTimestamp = seconds.toUTCString();
res.json({unix:date, utc: utcTimestamp})
}else{
res.json({error:"Invalid Date"})
}
})