2021-10-03 07:34:21 +05:30
|
|
|
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 20:48:00 +05:30
|
|
|
func ExampleNew() {
|
|
|
|
h := asynqmon.New(asynqmon.Options{
|
2021-10-03 07:34:21 +05:30
|
|
|
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
|
|
|
|
StaticContentHandler: asynqmon.NewStaticContentHandler(
|
|
|
|
staticContents,
|
|
|
|
"ui-assets",
|
|
|
|
"index.html",
|
|
|
|
),
|
|
|
|
})
|
2021-10-04 20:48:00 +05:30
|
|
|
defer h.Close()
|
2021-10-03 07:34:21 +05:30
|
|
|
|
|
|
|
srv := &http.Server{
|
2021-10-04 20:48:00 +05:30
|
|
|
Handler: h,
|
2021-10-03 07:34:21 +05:30
|
|
|
Addr: ":8080",
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Fatal(srv.ListenAndServe())
|
|
|
|
}
|