2021-10-03 10:04:21 +08:00
|
|
|
package asynqmon_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/hibiken/asynq"
|
|
|
|
"github.com/hibiken/asynqmon"
|
|
|
|
)
|
|
|
|
|
|
|
|
//go:embed ui-assets/*
|
|
|
|
var staticContents embed.FS
|
|
|
|
|
2021-10-04 23:18:00 +08:00
|
|
|
func ExampleNew() {
|
|
|
|
h := asynqmon.New(asynqmon.Options{
|
2021-10-03 10:04:21 +08:00
|
|
|
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
|
|
|
|
StaticContentHandler: asynqmon.NewStaticContentHandler(
|
|
|
|
staticContents,
|
|
|
|
"ui-assets",
|
|
|
|
"index.html",
|
|
|
|
),
|
|
|
|
})
|
2021-10-04 23:18:00 +08:00
|
|
|
defer h.Close()
|
2021-10-03 10:04:21 +08:00
|
|
|
|
|
|
|
srv := &http.Server{
|
2021-10-04 23:18:00 +08:00
|
|
|
Handler: h,
|
2021-10-03 10:04:21 +08:00
|
|
|
Addr: ":8080",
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Fatal(srv.ListenAndServe())
|
|
|
|
}
|