Skip to content

oGabrielArruda/api-charadas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Joke

Puzzles or jokes API to make the world a little happier :)


GitHub top language GitHub language count Codacy grade Repository size GitHub last commit Repository issues GitHub

How To Use   |    Technologies   |    References   |    Authors

💁 How To Use

🔓 Public routes

🌐 REQUEST

GET /puzzle?lang=ptbr
Parameter Type variable Type param Description Is required?
lang string query There are jokes in many languages Yes

⚡ RESPONSE

STATUS CODE: 200
{
  "_id": "60292b0e73850b391c8c4918",
  "question": "Qual o doce preferido dos noivos?",
  "answer": "Bem-casado.",
  "lang": "ptbr",
  "__v": 0
}

STATUS CODE: 400
{
  "error": "Language required"
}

STATUS CODE: 404
{
  "error": "Puzzle with this language was not found"
}

🔒 Private routes

🔑 All private routes require a security parameter. It is only possible to access the routes, passing this parameter. How does this parameter work?

Parameter Type variable Type param Description Is required?
token string header A security token in a hash type Yes

🌐 REQUEST

❗ This route has no parameters

POST /puzzle

⚡ RESPONSE

STATUS CODE: 200
[
  {
    "_id": "60292b0e73850b391c8c47e1",
    "question": "O que o Google pai disse para o Google filho na hora do jantar?",
    "answer": "Google, Chrome.",
    "lang": "ptbr"
  },
  {
    "_id": "60292b0e73850b391c8c47e2",
    "question": "Eu ia convidar 20 pessoas para a churrascada, uma morreu, o que faço?",
    "answer": "Covid 19.",
    "lang": "ptbr"
  },
  ...
]

STATUS CODE: 401
{
  "error": "Token not provided"
}

STATUS CODE: 401
{
  "error": "Token invalid"
}

🌐 REQUEST

DELETE /puzzle/id
Parameter Type variable Type param Description Is required?
id string default if you don't pass the ID all the jokes will be removed No

⚡ RESPONSE

STATUS CODE: 200
{
  "message": "Successfully removed"
}

STATUS CODE: 400
{
  "error": "Invalid ID"
}

STATUS CODE: 404
{
  "error": "Puzzle was not found"
}

🚀 Technologies

  • NodeJS
  • MongoDB
  • Mongoose
  • ExpressJS

📘 References

:person_with_blond_hair: Authors

About

An API that give random jokes in Portuguese.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published