Skip to content

Repository files navigation

Riddles API

Welcome to the Riddles API! This API provides a collection of riddles across various categories including funny, math, logic, and mystery. It's a fun way to challenge your mind and entertain yourself or your users with interesting riddles.

Base API URL

https://riddles-api-eight.vercel.app/{ category }

Routes

  • Funny Riddles: /funny

    • Endpoint to get funny riddles that will tickle your funny bone.
  • Math Riddles: /math

    • Endpoint to get math-related riddles that will test your mathematical skills.
  • Logic Riddles: /logic

    • Endpoint to get logic-based riddles that will make you think outside the box.
  • Mystery Riddles: /mystery

    • Endpoint to get mysterious riddles that will keep you guessing.
  • Science Riddles: /science

    • Endpoint to get science riddles that incorporate scientific concepts or phenomena..

Endpoints

MethodEndpointDescription
GET/categoryRetrieve specific riddle
GET/category/numberGet specified no. of riddles.
POST/categoryAdd a new riddle.
PATCH/category/idUpdate an existing riddle.
DELETE/category/idDeletes an existing riddle.

Example

Retrive riddles of science catefory

Get riddle based on science

https://riddles-api-eight.vercel.app/science

Response

{
"riddle": "string",
"answer": "string",
"category": "string"
}

Get 100 riddles based on science

https://riddles-api-eight.vercel.app/science/100

Response

{
"riddlesArray": ["riddleQuestions"],
"answer": "string",
"category": "string"
}

Post Riddle

POST/{ category }

 https://riddles-api-eight.vercel.app/{category}

Response

{
"message": "Riddle posted successfully",
"riddleQuestion": "riddleQuestion._id"
}

Installation

  1. Clone the repository:

    git clone https://github.com/Thiru-kumaran-R/Riddles-API.git
  2. Go to project folder:

    cd project
  3. Start the server:

    npm start

Error Handling

In case of any error, the API will return a JSON response with an appropriate status code and error message

Example

{
"message": "No such route exits",
"status": 404
}

About

API offers a diverse collection of riddles across various categories, including science, who-am-i, math, mystery, funny and logic.Integrate our API into your application to provide users with endless fun and intellectual stimulation.

Topics

Resources

Stars

17 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages