Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TaskIDCtxKey = ctxKey("TaskIDCtxKey")
TaskIDCtxKey tên của giá trị nằm trong request context
Functions ¶
func HeaderResponseContentTypeJSON ¶
HeaderResponseContentTypeJSON chèn thông tin định dạng JSON vào tiêu đề của gói tin được gửi đi.
Types ¶
type Middleware ¶
Middleware tạo một handler mới dựa trên handler được truyền vào.
func RequestLogger ¶
func RequestLogger(logger *log.Logger) Middleware
RequestLogger in ra thông tin của yêu cầu vừa được xử lý.
type Todo ¶
type Todo struct {
// contains filtered or unexported fields
}
Todo chứa các hàm số dùng để khởi tạo và chạy dịch vụ API.
func (*Todo) CreateOneTask ¶
func (todo *Todo) CreateOneTask() http.HandlerFunc
CreateOneTask lấy thông tin của một tác vụ từ body của request rồi gửi cho storage.Todo để xứ lý. @Summary Create one task @Description tạo một tác vụ mới @Accept json @Produce json @Param task body service.requestCreateOneTask true "tác vụ được thêm vào" @Failure 500 {object} service.responseCreateOneTaskErr @Failure 400 {object} service.responseCreateOneTaskErr @Success 200 {object} service.responseCreateOneTask @Router /todo [post]
func (*Todo) GetHello ¶
func (todo *Todo) GetHello() http.HandlerFunc
GetHello trả về một handler có thể xử lý yêu cầu HTTP và trả về chuỗi ký tự "Hello, world." @Summary Hello world @Description trả về chuỗi kí tự "Hello World" @Produce json @Success 200 {object} service.responseGetHello @Router /hello [get]