golazy.dev
–
golazy.dev
/
lazyapp
Index
|
Files
package lazyapp
import "golazy.dev/lazyapp"
Functions
func MustSub
func MustSub(fsys fs.FS, dir string) func() (fs.FS, error)
Types
type App
type App struct {
Name string
Context context.Context
Dispatcher *lazydispatch.Dispatcher
Router *lazyroutes.Scope
Assets *lazyassets.Registry
Sessions *lazysession.Manager
}
func New
func New(config Config) *App
func (app *App) ListenAndServe
func (app *App) ListenAndServe() error
func (app *App) ServeHTTP
func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Config
type Config struct {
Name string
Drawer func(*lazyroutes.Scope)
Public func() (fs.FS, error)
Views func() (fs.FS, error)
Context func(context.Context) context.Context
Helpers Helpers
SEO []lazyseo.Option
Assets []lazyassets.Source
AssetOptions []lazyassets.Option
Robots RobotsConfig
Sitemap SitemapConfig
Sessions lazysession.Config
Middlewares []lazydispatch.Middleware
ForceDetailErrors bool
}
type Helpers
type Helpers []map[string]any
type RobotsConfig
type RobotsConfig struct {
Disabled bool
Rules []RobotsRule
Sitemaps []string
Extra []string
}
type RobotsRule
type RobotsRule struct {
UserAgent string
Allow []string
Disallow []string
CrawlDelay string
}
type SitemapAlternate
type SitemapAlternate struct {
Language string
Location string
}
type SitemapConfig
type SitemapConfig struct {
Disabled bool
BaseURL string
URLs []SitemapURL
Sources []SitemapSource
}
type SitemapSource
type SitemapSource interface {
SitemapURLs() ([]SitemapURL, error)
}
type SitemapSourceFunc
type SitemapSourceFunc func() ([]SitemapURL, error)
func (fn SitemapSourceFunc) SitemapURLs
func (fn SitemapSourceFunc) SitemapURLs() ([]SitemapURL, error)
type SitemapURL
type SitemapURL struct {
Location string
LastUpdated time.Time
ChangeFreq string
Priority float64
Alternates []SitemapAlternate
}
ListenAndServe starts the app server on ADDR, PORT, or :3000.
It installs app.Context as the server base context, so every request context includes the dependencies initialized by New. When using a custom http.Server, set BaseContext to return app.Context.