Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 1.75 KB

01-timestamp.md

File metadata and controls

26 lines (21 loc) · 1.75 KB

freeCodeCamp API Timestamp Microservice

Main API Page
Heroku API - Timestamp Home
Heroku API - NOW
Heroku API - YYYY-MM-DD
Heroku API - UNIX

Timestamp Microservice Conditions

Instructions For Project
Example Project

  • You should provide your own project, not the example URL.
  • A request to /api/:date? with a valid date should return a JSON object with a unix key
  • A request to /api/:date? with a valid date should return a JSON object with a utc key
  • Proper JSON object format is a unix key in milliseconds (type, number) and utc key formated (type, string)
  • A request to /api/1451001600000 should return { unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }
  • Project can handle dates that can be successfully parsed by new Date(date_string)
  • If the input date string is invalid, the api returns an object having the structure { error : "Invalid Date" }
  • An empty date parameter should return the current time in a JSON object with a unix key
  • An empty date parameter should return the current time in a JSON object with a utc key

Customization & Cleanup

  • Optimize code and remove testing console logs, deprecate file but keep copy for reference later
  • Document operations of code