API Timestamp Microservice Project: Correct?

I just finished the first API project for the backend certificate, but I’m not actually sure I did it correctly. The requirements seem pretty straight forward, but I just want to be sure. Could someone just take a quick look at my project and confirm that it does what it’s supposed to do?

https://glory-amount.glitch.me/

p.s.
I added the top heading and input box just because I wanted to include something slightly different, and to go a little beyond the requirements. I know the top portion is irrelevant to the user stories.

I get a failure when I paste at the end of your project url /api/timestamp/1450137600, which is from your ‘example usage’ section.

When I follow your example usage, the response I get is:
TypeError: Cannot read property 'date' of undefined at getDate (/app/server.js:62:20)

The goal is to provide a json object as a response {"unix":1451001600000, "utc":"Fri, 25 Dec 2015 00:00:00 GMT"}, for example, so that a user who requests it by going to your endpoint [project_url]/api/timestamp/:date_string? can get it and use it according to their needs. They may be building an app and want to use that response, which means they’ll have to write some code on their end which extracts the relevant data from the json object served up as a response by you.

If I can’t go to https://glory-amount.glitch.me/api/timestamp/2015-12-25 and get a response like the example output given on your project page ({"unix":1451001600000, "utc":"Fri, 25 Dec 2015 00:00:00 GMT"}), your service isn’t working.

1 Like

@willjw3 Thanks for pointing out that error in my code! I think I got focused on adding my own feature that I forgot to re-test the original requirements. The errors should be fixed now: https://glory-amount.glitch.me/

And thank you for clarifying the project requirements. The real-world use case is now clear to me.

Seems to be working now. Glad to see that.

One thing to keep in mind, though, is that, even though your code works, when making a service for use by, say, a front-end developer who wants to go to your endpoint and get the response you’ve offered, you should also be careful about the documentation. Specifically, write up instructions that are tailored for someone who just knows how to make an API call and isn’t concerned with what your code looks like under the surface. For example, GET [project url]/api/timestamp/2015-12-25 probably doesn’t need to include the GET part in the documentation; they may or may not know what that means and it might confuse them. Just give them exactly what they need to use your service.

Good luck.

1 Like

So your placeholder text shows yyy/mm/dd and I exactly followed that but my thinking was that I didn’t need to enter ‘1956’ I only needed to enter ‘956’ and it would assume the digit one in front. Naturally, it didn’t. Fix your placeholder since 956/01/01 is very different from 1956/01/01

1 Like

Awesome man. Thank you so much for the advice.

1 Like

@Roma Thank you for taking the time to look at my project and pointing out that type-o. I just fixed it.

:+1: Good job…that’s what I expect to see