respond

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package respond is inspired by matryer/respond. The API is very similar but the package is customized for usage in this project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func With

func With(w http.ResponseWriter, r *http.Request, code int, data interface{})

func WithError

func WithError(w http.ResponseWriter, _ *http.Request, code int, err error)

func WithRedirect

func WithRedirect(w http.ResponseWriter, r *http.Request, dest string)

func WithStatus

func WithStatus(w http.ResponseWriter, r *http.Request, code int)

func WithTemplate

func WithTemplate(w http.ResponseWriter, r *http.Request, tmpl *template.Template, data interface{})

Types

type Msg

type Msg struct {
	Ok     bool          `json:"ok"`
	Error  string        `json:"error,omitempty"`
	Route  *model.Route  `json:"route,omitempty"`
	Routes []model.Route `json:"routes,omitempty"`
}

Jump to

Keyboard shortcuts

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