pkg

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors added in v1.2.0

func Cors() func(next http.Handler) http.Handler

func LogRequest

func LogRequest() func(next http.Handler) http.Handler

LogRequest a small middleware function which logs request details

func WriteErrorJsonResponse

func WriteErrorJsonResponse(w http.ResponseWriter, statusCode int, message string)

func WriteJsonResponse

func WriteJsonResponse(w http.ResponseWriter, statusCode int, apiResp ApiResponse)

func WriteOKJsonResponse

func WriteOKJsonResponse(w http.ResponseWriter, statusCode int)

func WritePlainTextResponse

func WritePlainTextResponse(w http.ResponseWriter, statusCode int, message []byte)

func WriteResponseBytes

func WriteResponseBytes(w http.ResponseWriter, contentType string, statusCode int, message []byte)

Types

type ApiResponse

type ApiResponse struct {
	Result  string `json:"result,omitempty"`
	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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