Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gahbr/timestamp-microservice
A Nodejs Microservice that is able to convert between Unix time and Human readable time.
https://github.com/gahbr/timestamp-microservice
backend freecodecamp freecodecamp-challenge microservice node nodejs unixtimeconverter
Last synced: 5 days ago
JSON representation
A Nodejs Microservice that is able to convert between Unix time and Human readable time.
- Host: GitHub
- URL: https://github.com/gahbr/timestamp-microservice
- Owner: Gahbr
- Created: 2022-08-30T16:44:26.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-02T17:40:51.000Z (about 2 years ago)
- Last Synced: 2023-03-05T07:37:41.085Z (over 1 year ago)
- Topics: backend, freecodecamp, freecodecamp-challenge, microservice, node, nodejs, unixtimeconverter
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Status: Finished
About •
Layout •
How it works •
Tech Stack## About
A Nodejs Microservice that is able to convert between Unix time and Human readable time. This project was proposed as a challenge in freecodecamp's "Back End Development and APIs" course.---
## Layout
![timestamp](https://user-images.githubusercontent.com/80289718/187510478-13395d8d-bb02-4864-aa38-161b2df66d08.png)---
## User Stories
* The API endpoint is GET [project_url]/api/timestamp/:date_string
* A date string is valid if can be successfully parsed by new Date(date_string).
* Note that the unix timestamp needs to be an integer (not a string) specifying milliseconds.
* If the date string is empty it should be equivalent to trigger new Date(), i.e. the service uses the current timestamp.
* If the date string is valid the api returns a JSON having the structure
{"unix": , "utc" : }
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" }.---
### Pre-requisitesBefore you begin, you will need to have the following tools installed on your machine:
[Git] (https://git-scm.com), [Node.js] (https://nodejs.org/en/).
In addition, it is good to have an editor to work with the code like [VSCode] (https://code.visualstudio.com/)#### Running the application (server)
```bash
# Clone this repository
$ git clone https://github.com/Gahbr/Timestamp-Microservice
# Access the project folder cmd/terminal
$ cd Timestamp-Microservice
# install the dependencies
$ npm install
# Run the application in development mode
$ npm run dev
# The server will start at port: 5000 - go to http://localhost:5000
```---
## Tech Stack
The following tools were used in the construction of the project:
> See the file [package.json](https://github.com/Gahbr/Timestamp-Microservice/blob/main/package.json)
#### [](https://github.com/Gahbr/Timestamp-Microservice)**Server** ([NodeJS](https://nodejs.org/en/) + [HTML/CSS](https://pt.wikipedia.org/wiki/HTML))
- **[Nodejs](https://nodejs.org/)**
- **[Express](https://expressjs.com/)**
- **[CORS](https://expressjs.com/en/resources/middleware/cors.html)**
- **[dotENV](https://github.com/motdotla/dotenv)**---