-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Description
Hi teams,
I want to serving FileSystem handler in gorilla mux framework.
But always don't work well, show code:
import (
"flag"
"log"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
_ "github.com/kubeflow/pipelines/backend/src/apiserver/openapi/generate/statik"
)
func main() {
r := mux.NewRouter()
// StatikFS serve.
statikFS, _ := fs.New()
r.PathPrefix("").Handler(http.StripPrefix("/swagger", http.FileServer(statikFS)))
srv := &http.Server{
Handler: r,
Addr: "127.0.0.1:8000",
// Good practice: enforce timeouts for servers you create!
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
log.Printf("serving")
log.Fatal(srv.ListenAndServe())
}
thanks
Metadata
Metadata
Assignees
Labels
No labels