Skip to content

Instantly share code, notes, and snippets.

@aiherrera
Last active September 24, 2024 17:18
Show Gist options
  • Save aiherrera/3ea9c2152a3748fa26977c87e1b3f6bd to your computer and use it in GitHub Desktop.
Save aiherrera/3ea9c2152a3748fa26977c87e1b3f6bd to your computer and use it in GitHub Desktop.
Best practices
1. Nunca hacer merge directo a main, siempre hacer PRs
2. Todos los endpoints deben seguir la siguiente estructura: `http://localhost:8000/api/v1/....`
3. Todas las respuestas debe seguir la siguiente estructura:
// Example returning data(Listing)
{
"status": 200,
"data": {
[
{
"name": "Euro",
"abbreviation": "EUR",
"id": 1
}
]
}
}
// Example returning data(One record)
{
"status": 200,
"data": {
{
"name": "Euro",
"abbreviation": "EUR",
"id": 1
}
}
}
// Example returning a message
{
"status": 200,
"data": {
"message": "Created successfully"
}
}
// Example returning a 422 Unprocessable Entity error
{
"status": 422,
"error": {
"message": "Field name should be a string",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment