Radovid is an Auction House API, written in Go, using SQLite and Docker. The API has some tests to ensure the application works well.
The Auction House stores on Database the bids, items and users. The API uses JWT token to authenticate users.
All you need to run the application is having Docker installed.
docker compose up -dThis command will build and start Radovid API.
- GET /ping
- Description: A simple health check route to verify that the server is running.
- Response:
{
"message": "pong"
}- GET /users
- Description: Retrieves a list of all users.
- Response: Array of user objects.
- POST /user
- Description: Creates a new user.
- Request Body:
{
"name": "string",
"email": "string",
"password": "string"
}- Response: The created user object or error message.
- GET /user/:id
- Description: Retrieves a specific user by their ID.
- Response: The user object or error message if not found.
- GET /items
- Description: Retrieves a list of all available items.
- Response: Array of item objects.
- GET /item/:id
- Description: Retrieves details of a specific item by its ID.
- Response: The item object or error message if not found.
- POST /login
- Description: Logs in a user and returns a JWT token.
- Request Body:
{
"email": "string",
"password": "string"
}- Response:
{
"access_token": "string",
"expire_at": "Date"
}- Protected Routes (Authentication Required)
The following routes require a valid JWT token for access. The token must be included in the Authorization header as Bearer .
8.1 POST /item
- Description: Creates a new item (protected route).
- Request Body:
{
"name": "string",
"description": "string",
"price": "integer",
"image_url": "string",
"user_id": "string"
}- Response: The created item object or error message.
8.2 POST /bid
- Description: Places a bid on an item (protected route).
- Request Body:
{
"amount": "integer",
"withdrawn_in": "integer",
"item_id": "string",
"user_id": "string"
}- Response: The created bid object or error message.
8.3 DELETE /bid/:id
- Description: Withdraws a bid by its ID (protected route).
- Responsei: Success message or error message if the bid cannot be withdrawn.
To access protected routes, you must authenticate by logging in through the /login route and include the JWT token in subsequent requests using the Authorization: Bearer header.
All routes return appropriate error messages if something goes wrong, including validation errors, resource not found errors, or unauthorized access attempts.
This documentation provides a detailed overview of how to use the API, what each route does, and what is expected when making POST requests.
Made with 💜 by Felipe Heredia!