Skip to content

mbient/is-towel-day

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Towel Day API

Overview

The Towel Day API is a simple API that provides information about Towel Day, celebrated on May 25th in honor of Douglas Adams, the author of "The Hitchhiker's Guide to the Galaxy." This API allows users to check if today is Towel Day and how many days remain until the next Towel Day.

Run script for simplified setup

chmod +x setup.sh && ./setup.sh

Running the API in a Podman Container - Step by step

To run the Towel Day API in a Pod, follow these steps:

Install Podman: Ensure that Podman is installed on your system. You can refer to the official Podman documentation for installation instructions.

Build Containers: Run the following commands in the directories containing your Containerfile:

cd backend/
podman build -t backend .

cd ../proxy
podman build -t proxy .

Create Pod:

podman pod create --name mypod -p 8081:80

Run Containers: Start containers with the following commands:

podman run -dt --rm --pod mypod backend:latest
podman run -dt --rm --pod mypod proxy:latest

Access the API: You can now access the API by navigating to http://localhost:8081 in your web browser or using curl.

API Endpoint

Method Endpoint Description
GET / Returns information about Towel Day, including whether today is Towel Day and how many days are left until the next one.

Example Query

To check if today is Towel Day, you can use the following command:

# Check server
curl -sI localhost:8081 | grep "Server" | awk '{print $2}'

curl -X GET http://localhost:8081

Example Response

The API will return a JSON response similar to the following:

{
  "is_event": false,
  "event_date": "May 25",
  "current_date": "September 1",
  "days_until": 237,
  "message": "There are 237 days until Towel Day."
}

If you have any further questions or need assistance, feel free to ask!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published