server

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithVars

func WithVars(handler HandlerWithVars, getVarsFunc VarsFactory) http.HandlerFunc

Types

type App

type App struct {
	Service
	Storage
}

func (*App) AppPage

func (app *App) AppPage(vars map[string]string, w http.ResponseWriter, r *http.Request)

func (*App) JsonHandler

func (app *App) JsonHandler(vars map[string]string, w http.ResponseWriter, r *http.Request)

func (*App) SandboxHandler

func (app *App) SandboxHandler(vars map[string]string, w http.ResponseWriter, r *http.Request)

func (*App) SvgHandler

func (app *App) SvgHandler(vars map[string]string, w http.ResponseWriter, r *http.Request)

type BlobAccessor

type BlobAccessor interface {
	Get(id int64) *zblob.Zblob
	GetByCid(cid string) *zblob.Zblob
	GetMaxId() int64
	Create(ipfsCid, base64Zipped, title, description, keywords, referrer string) (int64, error)
}

type HandlerWithVars

type HandlerWithVars = func(vars map[string]string, w http.ResponseWriter, r *http.Request)

type Service

type Service interface {
	IndexPage() *template.Template
	Event(eventType string, params map[string]interface{})
	GetState(r *http.Request) (state metamodel.Vector, ok bool)
	CheckForSnippet(hostname string, url string, referrer string) (string, bool)
	CheckForModel(hostname string, url string, referrer string) (string, bool)
}

type Storage

type Storage struct {
	Model   BlobAccessor
	Snippet BlobAccessor
}

type VarsFactory

type VarsFactory = func(r *http.Request) map[string]string

Jump to

Keyboard shortcuts

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