Time Stamp Microservice Feedback Please!

I finally finished my first Apis and Microservices Projects but I am not sure if I have done it correctly since there is no test function.
It would be great if anyone could five me some feedback!
Also, this is pretty much my first time using github, so let me know if I am using it incorrectly.

glitch: https://timestamp-microservice-test.glitch.me/
github: https://github.com/Eriko87/Time-Stamp-Microservice/tree/master

Thanks!

OK:

https://timestamp-microservice-test.glitch.me/api/timestamp/2015-12-15
{"unix":1450137600000,"utc":"Tue, 15 Dec 2015 00:00:00 GMT"}

This is strange, why 13 Jan 47923? It has same unix as above!

https://timestamp-microservice-test.glitch.me/api/timestamp/1450137600000
{"unix":1450137600000,"utc":"Sat, 13 Jan 47923 00:00:00 GMT"}

OK:

https://timestamp-microservice-test.glitch.me/api/timestamp/
{"unix":1563565430.65,"utc":"Fri, 19 Jul 2019 19:43:50 GMT"}

OK:

https://timestamp-microservice-test.glitch.me/api/timestamp/1450137600000_INVALID
{"unix":null,"utc":"Invalid Date"}

Thanks for pointing out!
I changed some code as below and now I think it’s working.

before:

res.json({"unix": parseInt(date_string), "utc" : new Date(parseInt(date_string)* 1000).toUTCString()});

after:

res.json({"unix": parseInt(date_string), "utc" : new Date(parseInt(date_string)).toUTCString()});
1 Like

I gave the following response concerning the same project recently:

When I did the basic freeCodeCamp API projects, I made the same mistake most people do when they go through them; I just filled in the back-end logic without thinking much about what I was tasked with doing.

The client-facing part of the example project (project landing page) provides the user stories the full-stack developer (you, me, and the other fCC campers who tackle it) needs to make a full-stack app that is consumable by, say, a front-end developer. So, leaving those user stories and everything else there, after making the app functional, isn’t really optimal.

Creating an API means more than just making it functional; proper documentation is highly important. So much so that there are people who make a living just writing documentation. To that end, if I were to do the projects again, I would create a different-looking landing page with documentation appropriate for anyone who would consume my API. The documentation that’s there now is for the person building the API.

But, like I said, I didn’t do that either for this particular project. Still though, it would be worth your while I think to do a proper landing page for would-be users of your API.

2 Likes

Good point. I also ignored that in my api-projects. I didn’t even think about it…

So - in case of the fcc api projects - these two should be edited

  • index.html (for call in browser)
  • readme.md (for Github)

That’s what I would do.

Thank you, both! I will update those two.