http

package
v0.0.0-...-4d56773 Latest Latest
Warning

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

Go to latest
Published: May 11, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebHandler

func WebHandler(c echo.Context) error

Types

type CreatePayload

type CreatePayload struct {
	Target    string `json:"target,omitempty" valid:"url,required"`
	SubDomain string `json:"sub_domain,omitempty" valid:"alphanum,required"`
}

CreatePayload represents the JSON payload for HandleCreate.

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Details string `json:"details"`
}

Error represents an error encoded in JSON given as response for HTTP requests when an error occurs.

func NewJSONError

func NewJSONError(code, message string, err error) *Error

NewJSONError creates a JSON serializable error.

type JSONRedirection

type JSONRedirection struct {
	ID        int    `json:"id"`
	SubDomain string `json:"sub_domain"`
	URL       string `json:"url"`
}

JSONRedirection is the struct that represents a cochonou.Redirection in JSON.

type RedirectionHandler

type RedirectionHandler struct {
	DomainHandler cochonou.DomainHandler
	Store         cochonou.RedirectionStore
}

RedirectionHandler is the struct containing all functions to handle HTTP actions with Redirections.

func (*RedirectionHandler) HandleCreate

func (h *RedirectionHandler) HandleCreate(c echo.Context) error

HandleCreate creates a DomainRedirection from an HTTP request.

func (*RedirectionHandler) HandleGetList

func (h *RedirectionHandler) HandleGetList(c echo.Context) error

HandleGetList gets all Redirection from the store and returns them as JSON.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(data map[string]interface{}) *Renderer

func (*Renderer) Render

func (r *Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Jump to

Keyboard shortcuts

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