remove NewStaticContentHandlerFunc

This commit is contained in:
ajatprabha
2021-10-05 11:39:11 +05:30
committed by Ken Hibino
parent cb4ccea025
commit 0cbec9318f
6 changed files with 31 additions and 45 deletions

View File

@@ -1,30 +1,28 @@
package asynqmon_test
import (
"embed"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/hibiken/asynq"
"github.com/hibiken/asynqmon"
)
//go:embed ui-assets/*
var staticContents embed.FS
func ExampleNew() {
h := asynqmon.New(asynqmon.Options{
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
StaticContentHandler: asynqmon.NewStaticContentHandler(
staticContents,
"ui-assets",
"index.html",
),
})
defer h.Close()
r := mux.NewRouter()
r.PathPrefix("/api").Handler(h)
// Add static content handler or other handlers
// r.PathPrefix("/").Handler(h)
srv := &http.Server{
Handler: h,
Handler: r,
Addr: ":8080",
}