api

package
v0.0.0-...-6f67f49 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoute

func AddRoute(router *chi.Mux, route Route)

func AddRoutes

func AddRoutes(router *chi.Mux, routes []Route)

func BadRequest

func BadRequest(r *http.Request, w http.ResponseWriter, content interface{})

func InternalServerError

func InternalServerError(r *http.Request, w http.ResponseWriter, content interface{})

func NoContent

func NoContent(w http.ResponseWriter)

func Ok

func Ok(r *http.Request, w http.ResponseWriter, content interface{})

func SetResponse

func SetResponse(w http.ResponseWriter, r *http.Request, status int, content interface{})

func Unauthorized

func Unauthorized(w http.ResponseWriter)

Types

type Method

type Method int
const (
	Method_Get Method = iota
	Method_Put
	Method_Post
	Method_Delete
)

type Route

type Route struct {
	Method         Method
	Path           string
	Handler        http.HandlerFunc
	AllowAnonymous bool
}

func Delete

func Delete(path string, handler http.HandlerFunc) Route

func Get

func Get(path string, handler http.HandlerFunc) Route

func Post

func Post(path string, handler http.HandlerFunc) Route

func Put

func Put(path string, handler http.HandlerFunc) Route

Jump to

Keyboard shortcuts

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