kngy0306 / go-api-sample

Go x MySQL x DockerなAPIサーバー

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang API Server Sample

Abstract

Getting Started

git pull https://github.com/naoki-kishi/go-api-sample
cd go-api-sample
docker-compose up

API docments

Entry

Response example

{
  "id": 1,
  "title": "entry1",
  "tags": [
    {
      "id": 1,
      "name": "tag1"
    }
  ]
}

Get all entries

GET /entries

Get an entry by id

GET /entries/:id

Create an entry

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"
    }
  ]
}

Update an entry

PUT /entries/:id

Delete an entry

DELETE /entries/:id

Tag

Response example

{
  "id": 1,
  "name": "tag1"
}

Get all tags

GET /tags

Get a tag by id

GET /tags/:id

Create a tag

POST /tag

Update a tag

PUT /tags/:id

Delete a tag

DELETE /tags/:id

References

About

Go x MySQL x DockerなAPIサーバー

License:MIT License


Languages

Language:Go 72.3%Language:Shell 26.8%Language:Dockerfile 0.9%