handler

package
v0.0.0-...-ab7defa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePost

func CreatePost(w http.ResponseWriter, r *http.Request)

CreatePost @Summary Create a new post @Tags Post @Accept json @Produce json @Param data body post.Post true "data" @Success 200 {string} string "successfully post created" @Failure 400 {string} string @Failure 500 {string} string @Router /post post

func DeletePost

func DeletePost(w http.ResponseWriter, r *http.Request)

DeletePost @Summary Delete post @Tags Post @Accept json @Produce json @Param id path string true "ID" @Success 200 {nil} nil @Failure 404 {string} string @Router /post/{id} [delete]

func GetHealth

func GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth godoc @Summary Returns health of the service @Router /healthz [get]

func GetPost

func GetPost(w http.ResponseWriter, r *http.Request)

GetPost @Summary Get post @Tags Post @Accept json @Produce json @Param id path string true "ID" @Success 200 {object} post.Post @Failure 404 {string} string @Router /post/{id} [get]

func GetTime

func GetTime(w http.ResponseWriter, r *http.Request)

GetTime @Summary Get time diff @Tags Time @Accept json @Produce json @Success 200 {object} time.Time @Failure 404 {string} string @Router /time [get]

func PostList

func PostList(w http.ResponseWriter, r *http.Request)

PostList @Summary Get post list @Tags Post @Accept json @Produce json @Success 200 {object} []post.Post @Failure 404 {string} string @Router /post [get]

func ResetTime

func ResetTime(w http.ResponseWriter, r *http.Request)

ResetTime @Summary Create a new puso @Tags Time @Accept json @Produce json @Success 200 {string} string "successfully reset" @Router /time post

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, msg interface{})

RespondWithError return error message

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON write json response format

func UpdatePost

func UpdatePost(w http.ResponseWriter, r *http.Request)

UpdatePost @Summary Update post @Tags Post @Description Update post @Accept json @Produce json @Param id path string true "ID" @Success 200 {string} string "successfully updated" @Failure 400 {string} string @Failure 404 {string} string @Router /post/{id} [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL