Skip to content

Commit

Permalink
Added .replit
Browse files Browse the repository at this point in the history
Lockfile
Readme
  • Loading branch information
Obaida Albaroudi authored and scissorsneedfoodtoo committed Jul 8, 2020
1 parent 2c518af commit a9b12d4
Show file tree
Hide file tree
Showing 4 changed files with 395 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language = "nodejs"
run = "npm start"
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

### User stories:

[![Run on Repl.it](https://repl.it/badge/github/freeCodeCamp/boilerplate-project-timestamp)](https://repl.it/github/freeCodeCamp/boilerplate-project-timestamp)

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.
Expand All @@ -12,8 +14,8 @@ 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" }`.

#### Example usage:
* https://curse-arrow.glitch.me/api/timestamp/2015-12-25
* https://curse-arrow.glitch.me/api/timestamp/1451001600000
* https://Timestamp-Microservice--freecodecamp.repl.co/api/timestamp/2015-12-25
*https://Timestamp-Microservice--freecodecamp.repl.co/api/timestamp/1451001600000

#### Example output:
* {"unix":1451001600000, "utc":"Fri, 25 Dec 2015 00:00:00 GMT"}
Loading

0 comments on commit a9b12d4

Please sign in to comment.