handlers

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLink(env *Env, w http.ResponseWriter, r *http.Request) error

GET ?http://link creates the link and redirect to the link

func Exists

func Exists(name string) (bool, error)

func Favicon

func Favicon(env *Env, w http.ResponseWriter, r *http.Request) error

/ Favicon just for fun

func GetIndex

func GetIndex(env *Env, w http.ResponseWriter, r *http.Request) error

/ Single endpoint / / When there's a query we're using it's value to save the link in the database / If there's a code (eg: hostname.com/EnYQkRXzK30d) we redirect to the given value

func Index

func Index(env *Env, w http.ResponseWriter, r *http.Request) error

/ Favicon just for fun

func ParseQueryParameter added in v1.0.7

func ParseQueryParameter(param string) (int, int)

Types

type Env

type Env struct {
	Transport t.Transport
	Config    c.Config
}

type Error

type Error interface {
	error
	Status() int
}

type Handler

type Handler struct {
	Env     *Env
	Handler func(e *Env, w http.ResponseWriter, r *http.Request) error
}

type StatusError

type StatusError struct {
	Code int
	Err  error
}

func (StatusError) Error

func (se StatusError) Error() string

func (StatusError) Status

func (se StatusError) Status() int

Jump to

Keyboard shortcuts

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