controller

package
v0.0.0-...-38c5a15 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServeMux

func NewServeMux(conf *Config, u *usecase.Usecase) http.Handler

Types

type APIController

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

APIController is REST API controller

func NewAPIController

func NewAPIController(u *usecase.Usecase) *APIController

newAPIController constructs APIController with Usecase

func (*APIController) CatchAll

func (c *APIController) CatchAll(w http.ResponseWriter, r *http.Request)

func (*APIController) CreateShortcut

func (c *APIController) CreateShortcut(w http.ResponseWriter, r *http.Request)

func (*APIController) RegisterRoute

func (c *APIController) RegisterRoute(r *mux.Router)

type Config

type Config struct {
	DefaultRoute string
	APIRoute     string
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type JSONResponseWriter

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

func (JSONResponseWriter) Header

func (w JSONResponseWriter) Header() http.Header

func (JSONResponseWriter) Write

func (w JSONResponseWriter) Write(bs []byte) (int, error)

func (JSONResponseWriter) WriteBody

func (w JSONResponseWriter) WriteBody(body interface{}) error

func (JSONResponseWriter) WriteError

func (w JSONResponseWriter) WriteError(statusCode int, err error) error

func (JSONResponseWriter) WriteHeader

func (w JSONResponseWriter) WriteHeader(statusCode int)

type ShortcutController

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

ShortcutController is default controller

func NewShortcutController

func NewShortcutController(u *usecase.Usecase) *ShortcutController

NewShortcutController constructs ShortcutController with Usecase

func (*ShortcutController) CatchAll

func (c *ShortcutController) CatchAll(w http.ResponseWriter, r *http.Request)

func (*ShortcutController) GetShortcut

func (c *ShortcutController) GetShortcut(w http.ResponseWriter, r *http.Request)

func (*ShortcutController) RegisterRoute

func (c *ShortcutController) RegisterRoute(r *mux.Router)

Jump to

Keyboard shortcuts

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