blip

package module
v0.0.0-...-b28c917 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 8 Imported by: 0

README

blip

blip is the bridge between Go web applications and htmx.

Note: blip is experimental software under active development. Use at your own risk.

Installing

$ go get -u git.sr.ht/~wtfiscrq/blip

Documentation

Documentation is available in pkg.go.dev.

Examples

Check the examples directory.

License

Blip is released under the MIT License.


HTML is dead, long live HTML! -- many speculated

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithData

func ContextWithData(ctx context.Context, data any) context.Context

func DataFromContext

func DataFromContext(ctx context.Context) any

func SetData

func SetData(r *http.Request, data any)

SetData is a convenience function that modifies an http.Request context to include the specified data. Use DataFromContext to retrieve the data.

Types

type App

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

App implements http.Handler and is responsible for handling and rendering pages and fragments.

func New

func New(opts ...Option) *App

New creates a new instance of App.

Uses http.ServeMux as the default router and template.Template as the default renderer. Different implenentations can be specified using WithRouter and WithRenderer option functions.

func (*App) Route

func (app *App) Route(pattern string, tmplName string, handler http.Handler) *App

func (*App) ServeHTTP

func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Option

type Option func(*App)

func WithRenderer

func WithRenderer(r renderer.Renderer) Option

WithRenderer sets the default application renderer.Renderer.

func WithRouter

func WithRouter(r router.Router) Option

WithRouter sets the application router.Router.

Directories

Path Synopsis
htmx package provides helpers to read htmx headers from http.Request and add htmx headers to http.ResponseWriter.
htmx package provides helpers to read htmx headers from http.Request and add htmx headers to http.ResponseWriter.

Jump to

Keyboard shortcuts

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