api

package
v0.0.0-...-7d7a026 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package api implements a framework for creating a JSON API.

Index

Constants

This section is empty.

Variables

View Source
var BadRequest = NewError(400, "Bad request.")
View Source
var InternalServerError = NewError(500, "Internal server error.")

Functions

func Call

func Wrap

func Wrap(handle Handle) httprouter.Handle

Types

type Error

type Error interface {
	GetCode() int
	Error() string
}

func NewError

func NewError(code int, message string) Error

type Handle

type Handle func(r *http.Request, p httprouter.Params) (interface{}, Error)

Jump to

Keyboard shortcuts

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