web

package module
v0.0.0-...-696c3ba Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

README

web GoDoc

Web library for APIBox to integrate static file, template and API together.

See full document at: https://go-apibox.github.io/docs/#!web/web.md (Chinese)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

type CaptchaConfig

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

type Page

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

type Static

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

type Web

type Web struct {
	ServerName string

	RestartFunc func()
	// contains filtered or unexported fields
}

func FromConfig

func FromConfig(webRoot, host string, config *WebConfig) (*Web, error)

func New

func New(webRoot, host string) (*Web, error)

func (*Web) AddAPI

func (web *Web) AddAPI(api *API) *Web

AddAPI add a new api backend to web.

func (*Web) AddAPIs

func (web *Web) AddAPIs(apis []*API) *Web

AddAPIs add new api backends to web.

func (*Web) AddPage

func (web *Web) AddPage(page *Page) *Web

AddPage add a new page to web.

func (*Web) AddPages

func (web *Web) AddPages(pages []*Page) *Web

AddPages add new pages to web.

func (*Web) AddStatic

func (web *Web) AddStatic(static *Static) *Web

AddStatic add a new static path to web.

func (*Web) AddStatics

func (web *Web) AddStatics(statics []*Static) *Web

AddStatics add new static paths to web.

func (*Web) Debug

func (web *Web) Debug(debug bool) *Web

Debug set if print out debug message.

func (*Web) GetSessionStore

func (web *Web) GetSessionStore(sessionName string) *session.CookieStore

func (*Web) Handler

func (web *Web) Handler() http.Handler

func (*Web) NewAPIFunc

func (web *Web) NewAPIFunc(api *API) http.HandlerFunc

func (*Web) NewCaptchaFunc

func (web *Web) NewCaptchaFunc(page *Page) http.HandlerFunc

func (*Web) NewLoginFunc

func (web *Web) NewLoginFunc(page *Page) http.HandlerFunc

func (*Web) NewLogoutFunc

func (web *Web) NewLogoutFunc(page *Page) http.HandlerFunc

func (*Web) NewPageFunc

func (web *Web) NewPageFunc(page *Page) http.HandlerFunc

func (*Web) NewRestartFunc

func (web *Web) NewRestartFunc(page *Page) http.HandlerFunc

func (*Web) PageInject

func (web *Web) PageInject(name string, value interface{}) *Web

PageInject will inject data to all page.

func (*Web) PageInjectIncludeData

func (web *Web) PageInjectIncludeData(name, includeData string) *Web

PageInjectIncludeData will inject include data to all page.

func (*Web) PageInjectIncludeDataMap

func (web *Web) PageInjectIncludeDataMap(dataMap map[string]string) *Web

PageInjectIncludeDataMap will inject include data map to all page.

func (*Web) PageInjectMap

func (web *Web) PageInjectMap(dataMap map[string]interface{}) *Web

PageInjectMap will inject data map to all page.

func (*Web) PageInjectSession

func (web *Web) PageInjectSession(name, sessionName string) *Web

PageInjectSession will inject session data to all page.

func (*Web) PageInjectSessionMap

func (web *Web) PageInjectSessionMap(sessionMap map[string]string) *Web

PageInjectSessionMap will inject session map to all page.

func (*Web) Reload

func (web *Web) Reload(webRoot, host string, config *WebConfig)

func (*Web) RouteHandler

func (web *Web) RouteHandler(router *mux.Router) http.Handler

func (*Web) SetSessionDomain

func (web *Web) SetSessionDomain(sessionDomain string)

type WebConfig

type WebConfig config.Config

func NewConfig

func NewConfig(cfg *config.Config) *WebConfig

func (*WebConfig) GetAPIs

func (wc *WebConfig) GetAPIs() []*API

func (*WebConfig) GetBaseUrl

func (wc *WebConfig) GetBaseUrl() string

func (*WebConfig) GetDebug

func (wc *WebConfig) GetDebug() bool

func (*WebConfig) GetPageInjectData

func (wc *WebConfig) GetPageInjectData() map[string]interface{}

func (*WebConfig) GetPageInjectIncludeData

func (wc *WebConfig) GetPageInjectIncludeData() map[string]string

func (*WebConfig) GetPageInjectSessions

func (wc *WebConfig) GetPageInjectSessions() map[string]string

func (*WebConfig) GetPages

func (wc *WebConfig) GetPages() []*Page

func (*WebConfig) GetStatics

func (wc *WebConfig) GetStatics() []*Static

Jump to

Keyboard shortcuts

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