web

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidBookId = errors.New("invalid book id")

ErrInvalidBookId is an error representing an invalid or malformed book ID.

Functions

func BookIdPathParam

func BookIdPathParam(r *http.Request) (int, error)

BookIdPathParam extracts the 'id' parameter from the path of an HTTP request and converts it to an integer.

func Param

func Param(r *http.Request, key string) string

Param retrieves a path parameter from the URL of an HTTP request.

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, message string)

RespondWithError responds a json with an error message

func RespondWithJson

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

RespondWithJson responds a json with an error message

func RespondWithStatus

func RespondWithStatus(w http.ResponseWriter, code int)

RespondWithStatus responds with an HTTP status code

Types

This section is empty.

Jump to

Keyboard shortcuts

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