- Many to Many Web API Server Sample
- Web Framework : Gin (https://github.com/gin-gonic/gin)
- ORM : GORM (https://github.com/jinzhu/gorm)
git pull https://github.com/naoki-kishi/go-api-sample
cd go-api-sample
docker-compose up
{
"id": 1,
"title": "entry1",
"tags": [
{
"id": 1,
"name": "tag1"
}
]
}
GET /entries
GET /entries/:id
POST /entries
If you want to create relations with tags, you don't have to include tag id.
Request example
{
"id": 1,
"title": "entry1",
"tags": [
{
"name": "tag1"
}
]
}
PUT /entries/:id
DELETE /entries/:id
{
"id": 1,
"name": "tag1"
}
GET /tags
GET /tags/:id
POST /tag
PUT /tags/:id
DELETE /tags/:id