Hey, The code here isn’t working for this project (Timestamp Microservice for APIs and Microservices). Whenever I refresh all that shows up is this: cannot GET / .
I don’t understand what the problem could be. Could someone please help me out on this? Here’s the code for server.js:
var express = require(‘express’);
var cors = require(‘cors’);
var bodyParser = require(‘body-parser’);
var app =express();
app.use(bodyParser.json());
app.use(cors());
app.get(’/dateValues/:dateVal’, function(req,res){
var dateVal = req.params.dateVal;
var dateFormatingOptions = {
year:‘numeric’,
month:‘long’,
day:‘numeric’
};
if(isNaN(dateVal)){
var naturalDate = new Date(dateVal *1000)
naturalDate = naturalDate.tolocaleDatestring(“en-us”, dateFormatingOptions);
var unixDate = new Date(dateVal).getTime()/1000;
}
else
{
var unixdate=dateVal;
naturalDate = naturalDate.tolocaleDatestring(“en-us”, dateFormatingOptions);
}
res.json({unix: unixDate, natural: naturalDate});
});
app.listen(3000, function(){
console.log(“Timestamp”);
});
Here’s the code for package.json:
{ “author”: “Donna Amos”,
“name”: “timestamp-microservices-challenge”,
“version”: “0.0.1”,
“description”: “A time stamp page that converts time to unix and natural”,
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“dependencies”: {
“express”: “^4.12.4”,
“cors”: “^2.8.0”
},
“engines”: {
“node”: “4.4.5”
},
“repository”: {
“type”: “git”,
“url”: “https://github.com/donnacamos/timestamp-microservice-forReal”
},
“keywords”: [
“node”,
“hyperdev”,
“express”,
“freecodecamp”
],
“license”: “MIT”
}
Here’s the git repository for this project:
And here’s the glitch link for what shows up:
https://learned-roundworm.glitch.me/
Here’s the glitch link:
Thanks!