This project provides an API that exposes fortune and cowsay Linux commands using Deno and Hono frameworks.
Fortune is a program that displays a random message of encouragement or humor. It's commonly found on Unix-like systems and is known for its motivational quotes and witty sayings.
Cowsay is another popular Unix utility that displays ASCII art of a cow (or other animals) speaking the text you input. It's often used for humorous purposes in system administration and scripting.
- Built with Deno and Hono frameworks
- Exposes fortune and cowsay commands via API endpoints
- Uses cowfiles from the project directory
To run this API locally:
./run.sh
This will start the server on http://localhost:8080
.
You can also use the free public API hosted on RapidAPI: Fortune and Cowsay Public API
GET /v1/fortune/plain
Response:
{
"fortune": "\"I'm in Pittsburgh. Why am I here?\"\n\t\t-- Harold Urey, Nobel Laureate"
}
GET /v1/fortune/cowsay
Response:
{
"fortune": "_________________________________________ \n/ Today's scientific question is: What in \\\n| the world is electricity? |\n| |\n| And where does it go after it leaves |\n| the toaster? |\n| |\n\\ -- Dave Barry, \"What is Electricity?\" /\n ----------------------------------------- \n \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||"
}
GET /v1/fortune/random-cow
Response:
{
"fortune": "________________________________________ \n/ User n.: \\\n| |\n| A programmer who will believe anything |\n\\ you tell him. /\n ---------------------------------------- \n \\ (__) \n \\ /oo| \n \\ (_\"_)*+++++++++*\n //I#\\\\\\\\\\\\\\\\I\\\n I[I|I|||||I I `\n I`I'///'' I I\n I I I I\n ~ ~ ~ ~\n Scowleton"
}
GET /v1/cowsay?message=Hello%20Foobar
Response:
{
"fortune": "______________\n< Hello Foobar >\n --------------\n \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||"
}
project-root/
├─── main.ts
└── cowfiles/
├── cow1.txt
├── cow2.txt
└── ...
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open-source and licensed under the MIT License.