A fun and simple API that delivers random jokes or a list of jokes in multiple languages (English, Hindi, Bengali). This API, built using Node.js and Express, is perfect for fetching random jokes, language-specific jokes, or a complete list of jokes. With CORS support, it can be easily integrated into any frontend application.
- Fetch a random joke from the collection.
- Fetch all jokes.
- Fetch jokes in a specific language (English, Hindi, Bengali).
- CORS enabled for secure cross-origin requests.
- Easy to deploy on platforms like Render.
- URL:
/api/jokes/all
- Method:
GET
- Description: Returns a list of all jokes in all languages (English, Hindi, Bengali).
- Example Request:
curl https://jokes-api-test.onrender.com/api/jokes/all
- URL:
/api/jokes/random
- Method:
GET
- Description: Returns a random joke from the collection.
- Example Request:
curl https://jokes-api-test.onrender.com/api/jokes/random
- URL:
/api/jokes/:language
- Method:
GET
- Description: Fetch jokes in a specific language by passing the language name in the URL (
English
,Hindi
, orBengali
). - Example Request:
curl https://jokes-api-test.onrender.com/api/jokes/hindi
- Node.js
- Express.js
- Axios (For testing API calls in frontend)
- CORS (To handle cross-origin requests)
- Clone the repository:
git clone https://github.com/blackXploit-404/Free-Jokes-API
- Navigate to the project directory:
cd Free-Jokes-API
- Install dependencies:
npm install
- Start the server:
npm start
- Your API should now be running on
http://localhost:4000
.
You can easily deploy the Jokes API on platforms like Render. Follow the steps below:
- Fork the Repository: Fork the repository to your GitHub account.
- Create a Web Service:
- Sign up on Render.
- Create a new Web Service and connect it to your forked repository.
- Set the build command as
npm install
and start command asnpm start
.
- Deploy: Render will automatically build and deploy your app.
- Access: Once deployed, you'll receive a public URL like
https://your-app.onrender.com
.
For detailed deployment instructions, refer to the Render deployment guide.
Check out the live API on Render:
- All Jokes: https://jokes-api-test.onrender.com/api/jokes/all
- Random Joke: https://jokes-api-test.onrender.com/api/jokes/random
- Jokes by Language: https://jokes-api-test.onrender.com/api/jokes/hindi
This project is licensed under the MIT License - see the LICENSE file for details.