Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts Options) gear.Middleware
New creates a static middleware to serves static content from the provided root directory.
package main import ( "github.com/teambition/gear" "github.com/teambition/gear/middleware/favicon" "github.com/teambition/gear/middleware/static" ) func main() { app := gear.New() app.Use(favicon.New("./testdata/favicon.ico")) app.Use(static.New(static.Options{ Root: "./testdata", Prefix: "/", StripPrefix: false, })) app.Use(func(ctx *gear.Context) error { return ctx.HTML(200, "<h1>Hello, Gear!</h1>") }) app.Error(app.Listen(":3000")) }
Types ¶
Click to show internal directories.
Click to hide internal directories.