A simple Timestamp Microservice built using Express and Node.js that generates Unix and UTC timestamps for provided dates.
- Unix Timestamp: Provides the Unix timestamp for a given date.
- UTC Timestamp: Returns the UTC representation of the provided date.
- HTTP Request Handling: Accepts HTTP requests with a date parameter and responds with timestamp information.
git clone https://github.com/zhid0399123/datestamp.git
cd datestamp
pnpm install
npm start
The server runs on http://0.0.0.0:3000/v0/api/datestamp by default. You can modify the port in your .env
file
Send a GET request to:
http://0.0.0.0:3000/v0/api/datestamp/:date_string
Replace :date_string
in the URL with the date to convert (e.g., 2023-11-26, 1637894400 for Unix timestamp).
Example:
curl http://0.0.0.0:3000/v0/api/datestamp/2023-11-26
Response:
{
"unix": 1679942400,
"utc": "Sun, 26 Nov 2023 00:00:00 GMT"
}
The datestamp Microservice is deployed and accessible via fly.io, allowing users to interact with the API endpoints. Follow these steps to access the deployed API:
-
Base URL: The deployed API can be accessed at https://datestamp.fly.dev/v0/api/datestamp.
-
Usage Examples: Here's an example using cURL to convert a timestamp to Unix time:
curl -X GET https://datestamp.fly.dev/v0/api/datestamp/1627804800000
GET /v0/api/datestamp/:date_string
Retrieves Unix and UTC timestamps for the provided date.
Contributions are welcome! Feel free to open issues or submit pull requests. Please refer to the Contributing Guidelines to get started.
This project is licensed under the MIT License. Refer to the LICENSE file for more details.