https://github.com/jodaz/timestamp
Timestamp microservice project made for freeCodeCamp.
https://github.com/jodaz/timestamp
freecodecamp-project microservice nodejs timestamp-convert
Last synced: about 1 year ago
JSON representation
Timestamp microservice project made for freeCodeCamp.
- Host: GitHub
- URL: https://github.com/jodaz/timestamp
- Owner: jodaz
- License: mit
- Created: 2018-07-31T03:52:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T08:48:40.000Z (over 3 years ago)
- Last Synced: 2025-01-13T06:06:43.361Z (about 1 year ago)
- Topics: freecodecamp-project, microservice, nodejs, timestamp-convert
- Language: JavaScript
- Homepage:
- Size: 359 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# timestamp
A timestamp microservice project made for freeCodeCamp, built with Moment.js.
## User stories
* A date string is valid if can be successfully parsed by `moment()`.
* If the date string is empty it should be equivalent to trigger `moment()`, i.e. the service uses the current timestamp.
* If the date string is valid the api returns a JSON having the structure
`{"unix": moment().unix(), "utc" : moment.utc(moment().unix()) }`
e.g. {"unix": 1479663089000 ,"utc": "Sun, 20 Nov 2016 17:31:29 GMT"}
* If the date string is invalid the api returns a JSON having the structure
`{"error" : "Invalid Date" }`.
## Live demo
- [Glitch demo](https://jesuodz-timestamp.glitch.me/)
- [Medium post](https://medium.com/@jesuodz/building-a-timestamp-microservice-71a1645f09d9)
## Installation
Clone this repo, then install with `npm install` and start the server with `npm start`.