middleware

package
v0.0.0-...-1f9a799 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuthHandler

func CheckAuthHandler(next echo.HandlerFunc) echo.HandlerFunc

func CheckRoleHandler

func CheckRoleHandler(next echo.HandlerFunc) echo.HandlerFunc

func GenerateStateHandler

func GenerateStateHandler(next echo.HandlerFunc) echo.HandlerFunc

Types

type JSVM

type JSVM struct {
	*eventloop.EventLoop
	// contains filtered or unexported fields
}

JSVM wraps goja EventLoop

func (*JSVM) Handle

func (r *JSVM) Handle(req map[string]interface{}) <-chan Resp

Handle handles http requests

type React

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

React struct is contains JS vms pool to serve HTTP requests and separates some domain specific resources.

var ReactJS *React

func NewReact

func NewReact(filePath string, debug bool, proxy http.Handler) *React

NewReact initialized React struct

func (*React) Handle

func (r *React) Handle(c echo.Context) error

Handle handles all HTTP requests which have not been caught via static file handler or other middlewares.

type Resp

type Resp struct {
	UUID       string        `json:"uuid"`
	Error      string        `json:"error"`
	Redirect   string        `json:"redirect"`
	App        string        `json:"app"`
	Title      string        `json:"title"`
	Meta       string        `json:"meta"`
	Initial    string        `json:"initial"`
	RenderTime time.Duration `json:"-"`
}

Resp is a struct for convinient react app Response parsing. Feel free to add any other keys to this struct and return value for this key at ecmascript side. Keep it sync with: src/app/client/router/toString.js:23

func (Resp) HTMLApp

func (r Resp) HTMLApp() template.HTML

HTMLApp returns a application template

func (Resp) HTMLMeta

func (r Resp) HTMLMeta() template.HTML

HTMLMeta returns a meta data

func (Resp) HTMLTitle

func (r Resp) HTMLTitle() template.HTML

HTMLTitle returns a title data

Jump to

Keyboard shortcuts

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