web

package
v0.0.0-...-a46d881 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Port = "8081"
)

Variables

View Source
var (
	TemplatesDir  = filepath.FromSlash(filepath.Join("web", "templates"))
	TemplateFiles = []string{
		filepath.Join(TemplatesDir, "layout"),
		filepath.Join(TemplatesDir, "nav"),
		filepath.Join(TemplatesDir, "analytics"),
		filepath.Join(TemplatesDir, "typography"),
	}
	ReservedFiles = append(TemplateFiles, filepath.Join(TemplatesDir, "adminView"))

	StaticDir    = filepath.FromSlash(filepath.Join("web", "static"))
	SiteFilesDir = filepath.FromSlash(filepath.Join("web", "site_files"))
)

Functions

This section is empty.

Types

type ApiRouter

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

func NewApiRouter

func NewApiRouter(cfg *lib.Config, log *zap.Logger, client *lib.DBClient) (*ApiRouter, error)

func (*ApiRouter) BasicAuthMiddleware

func (a *ApiRouter) BasicAuthMiddleware(nextHandler http.HandlerFunc) http.HandlerFunc

BasicAuthMiddleware wraps a http.HandlerFunc in a Basic Auth check. ToDo: Could probably live in a middleware only file

func (*ApiRouter) RSVPCreate

func (a *ApiRouter) RSVPCreate(w http.ResponseWriter, r *http.Request)

func (*ApiRouter) RSVPDelete

func (a *ApiRouter) RSVPDelete(w http.ResponseWriter, r *http.Request)

func (*ApiRouter) RSVPGetAll

func (a *ApiRouter) RSVPGetAll(w http.ResponseWriter, r *http.Request)

func (*ApiRouter) SetupRoutes

func (a *ApiRouter) SetupRoutes(router *mux.Router)

type MiddlewareFunc

type MiddlewareFunc func(nextHandler http.HandlerFunc) http.HandlerFunc

type RenderContext

type RenderContext struct {
	TargetDate string
	TargetYear int
}

type Route

type Route struct {
	Path       string
	Method     string
	Handler    http.HandlerFunc
	MiddleWare MiddlewareFunc
}

type Server

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

ToDo: cache page responses somehow

func NewWebServer

func NewWebServer(cfg *lib.Config, log *zap.Logger, renderCtx *RenderContext, api *ApiRouter) *Server

func (*Server) Serve

func (s *Server) Serve() error

Jump to

Keyboard shortcuts

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