rest-api-common
Common code for building a REST API
Allows for simple CRUD microservices to be built quickly just by defining the GO struct to be stored in the database
Includes:
REST endpoints for implemented for this structure for CRUD operations
/status and /metrics endpoints for health and observability
Rate limiting middleware
Validation of submitted data for the specified GO struct
Logs of all status codes and errors
HTTPS
Music library Example implemented in the example folder
GET /api/albums
GET /api/albums/:id
POST /api/albums
POST /api/albums/:id
DELETE /api/albums/:id
Example JSON:
{
"name": "Purple Rain",
"artist": "Prince and The Revolution",
"year": "1984",
"tracks": ["Let's Go Crazy", "Take Me With U", "The Beautiful Ones", "Computer Blue", "Darling Nikki",
"When Doves Cry", "I Would Die 4 U", "Baby, I'm a Star", "Purple Rain"]
}
Build with:
docker build -t neiln3121/music-library .
Run with Mongo using
docker-compose up