chore: add multiple api example (#207)

* chore: add multiple api example
* chore: update README.md
This commit is contained in:
Bogdan U
2022-04-22 16:50:33 +03:00
committed by GitHub
parent bd7f2153bf
commit 88c9ed2643
15 changed files with 581 additions and 36 deletions
+26
View File
@@ -0,0 +1,26 @@
package v2
import (
"github.com/gin-gonic/gin"
)
type Book struct {
ID int `json:"id,omitempty"`
Title string `json:"title"`
Author string `json:"author"`
Year *uint16 `json:"year"`
}
//
// @Summary Get a list of books in the the store
// @Description get string by ID
// @Accept json
// @Produce json
// @Success 200 {array} Book "ok"
// @Router /books [get]
func GetBooks(ctx *gin.Context) {
ctx.JSON(200, []Book{
{ID: 1, Title: "Book 3", Author: "Author 3", Year: nil},
{ID: 2, Title: "Book 4", Author: "Author 4", Year: nil},
})
}