A pure-Go API using the database/sql package.
- RESTful architecture
- HATEOAS-driven navigation
- Error handling
- Comprehensive non-intrusive logging
- IP-based access control for selected methods
Operation | URI | Method | Status | Status Code | Availability |
---|---|---|---|---|---|
All riddles | /api/riddles | GET | OK Internal Server Error |
200 500 |
public |
Random riddle | /api/riddles/random | GET | Success Internal Server Error |
200 500 |
public |
Specific riddle | /api/riddles/{id} | GET | OK Bad Request Not found |
200 400 404 |
public |
Post riddle | /api/riddles | POST | Success Bad Request Internal Server Error |
201 400 500 |
public |
Delete riddle | /api/riddles/{id} | DELETE | OK Bad Request Not Found Internal Server Error Forbidden |
200 400 404 500 403 |
restricted |
Update riddle | /api/riddles/{id} | PATCH | OK Bad Request Not Found Internal Server Error Forbidden |
200 400 404 500 403 |
restricted |
{
"riddle": "What am I?",
"solution": "riddle",
"username": "mr smith", //optional
"user_email": "[email protected]" //optional
}
Operation | URI | Method | Status | Status Code | Availability |
---|---|---|---|---|---|
Riddle with DALLE generated image | /api/riddles/images/{id} | GET | OK Bad Request Not Found Internal Server Error Forbidden |
200 400 404 500 403 |
restricted |
Generates an image with the riddle as a prompt, and returns the riddle together with the image URL. In the backend, it retrieves the image and stores it in an image table.
{"style": "impressionist"}