Skip to content

alevanni/timestamp-microservice

Repository files navigation

User stories :

My preview The project can be found at: https://timestamp-microservice-for-fc.glitch.me/

  1. The API endpoint is GET [project_url]/api/timestamp/:date_string?
  2. A date string is valid if can be successfully parsed by new Date(date_string) (JS) . Note that the unix timestamp needs to be an integer (not a string) specifying milliseconds. In our test we will use date strings compliant with ISO-8601 (e.g. "2016-11-20") because this will ensure an UTC timestamp.
  3. If the date string is empty it should be equivalent to trigger new Date(), i.e. the service uses the current timestamp.
  4. If the date string is valid the api returns a JSON having the structure {"unix": <date.getTime()>, "utc" : <date.toUTCString()> } e.g. {"unix": 1479663089000 ,"utc": "Sun, 20 Nov 2016 17:31:29 GMT"}.
  5. If the date string is invalid the api returns a JSON having the structure {"error": Invalid Date" }.
  6. Automated test cases are in the file /test/functional-tests.js
  7. A very simple manual test case template is in the file /test/myTestCaseTemplate.ods
  8. Postman testcases and results are in the files /tests/GET Suite.postman_collection.json and /tests/GET Suite.postman_test_run.json

Example usage:

Example output:

  • { "unix": 1450137600, "natural": "December 15, 2015" }

About

A timestamp microservice exercise for FreeCodeCamp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published