server

package
v0.4.20 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VendorLibs map[string]string = map[string]string{
	"htmx":         "/vendor/htmx/htmx.min.js",
	"alpine.js":    "/vendor/alpine.js/alpine.min.js",
	"highlight.js": "/vendor/highlight/highlight.min.js",
}

Functions

This section is empty.

Types

type Config

type Config struct {
	RootPath    string
	Port        int
	VendorDir   fs.FS
	TemplateDir fs.FS
	LayoutDir   fs.FS
	PublicDir   fs.FS
}

type Hubro

type Hubro struct {
	Mux       *http.ServeMux
	Server    *http.Server
	Templates *template.Template
	// contains filtered or unexported fields
}

func NewHubro

func NewHubro(config Config) *Hubro

func (*Hubro) AddModule

func (h *Hubro) AddModule(prefix string, module HubroModule, options any)

func (*Hubro) ErrorHandler

func (h *Hubro) ErrorHandler(w http.ResponseWriter, r *http.Request, status int, message *string)

func (*Hubro) FileServerWithDirectoryListingDisabled added in v0.2.12

func (hu *Hubro) FileServerWithDirectoryListingDisabled(h http.Handler) http.Handler

func (*Hubro) GetHandler

func (h *Hubro) GetHandler() http.Handler

GetHandler returns the http.Handler for the Hubro instance with all middlewares applied.

func (*Hubro) Render

func (h *Hubro) Render(w http.ResponseWriter, r *http.Request, templateName string, data any)

func (*Hubro) RenderWithLayout

func (h *Hubro) RenderWithLayout(
	w http.ResponseWriter,
	r *http.Request,
	layoutName string,
	templateName string,
	data any)

func (*Hubro) RenderWithoutLayout

func (h *Hubro) RenderWithoutLayout(w http.ResponseWriter, r *http.Request, templateName string, data any)

func (*Hubro) Start

func (h *Hubro) Start(startTime time.Time) error

func (*Hubro) Use

func (h *Hubro) Use(m Middleware)

type HubroModule

type HubroModule func(string, *Hubro, *http.ServeMux, any)

type Middleware

type Middleware func(*Hubro) func(http.Handler) http.Handler

Jump to

Keyboard shortcuts

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