package main import ( "fmt" "github.com/mholt/caddy" "github.com/mholt/caddy/caddyhttp" ) func main() { c := caddy.New() httpConfig := caddyhttp.DefaultConfig httpConfig.Root = "/var/www/" c.AddHTTPMiddleware(httpConfig) c.Start() fmt.Println("Caddy is running") }
package main import ( "fmt" "github.com/mholt/caddy" "github.com/mholt/caddy/caddyhttp" ) func main() { c := caddy.New() httpConfig := caddyhttp.DefaultConfig httpConfig.Browse = true c.AddHTTPMiddleware(httpConfig) c.Start() fmt.Println("Caddy is running") }This example configures a Caddy server with directory browsing enabled. Package library: github.com/mholt/caddy.