reload

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 8 Imported by: 2

README

✨ Reload

Go Reference Go Report Card Taylor Swift

This is an experimental middleware for Fiber ⚡️. It will reload the current page and all its dependencies.

Installation

$ go get github.com/zeiss/fiber-reload

Examples

Please have a look at examples/main.go for a simple example.

License

MIT

Documentation

Overview

🚀 Fiber is an Express inspired web framework written in Go with 💖 📌 API Documentation: https://fiber.wiki 📝 Github Repository: https://github.com/gofiber/fiber

Index

Constants

View Source
const (
	// Noop is a no-op function.
	Noop = "noop"
	// Environment environment
	Development = "development"
	// Testing environment
	Testing = "testing"
	// Staging environment
	Staging = "staging"
	// Production environment
	Production = "production"
)

Variables

View Source
var ConfigDefault = Config{
	IdGenerator: DefaultIdGenerator,
}

ConfigDefault is the default config.

Functions

func DefaultIdGenerator

func DefaultIdGenerator() []byte

DefaultIdGenerator generates a new UUID.

func Environment

func Environment(env string) fiber.Handler

Environment is a middleware that sets the environment context.

func GetEnvironmentContext

func GetEnvironmentContext(ctx context.Context) (string, error)

GetEnvironmentContext gets the environment context.

func IsDevelopment

func IsDevelopment(ctx context.Context) bool

IsDevelopment returns true if the environment is development.

func IsProduction

func IsProduction(ctx context.Context) bool

IsProduction returns true if the environment is production.

func IsStaging

func IsStaging(ctx context.Context) bool

IsStaging returns true if the environment is staging.

func IsTesting

func IsTesting(ctx context.Context) bool

IsTesting returns true if the environment is testing.

func Reload

func Reload(config ...Config) fiber.Handler

Reload is a middleware that enables a live reload of a site.

func SetEnvironmentContext

func SetEnvironmentContext(c *fiber.Ctx, env string) error

SetEnvironmentContext sets the environment context.

func WithHotReload

func WithHotReload(app *fiber.App, config ...Config)

WithHotReload is a middleware that enables a live reload of a site.

Types

type Config

type Config struct {
	// IdGenerator
	IdGenerator func() []byte

	// Next defines a function to skip this middleware when returned true.
	Next func(c *fiber.Ctx) bool
}

Config ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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