mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-18 18:55:54 +08:00
33 lines
532 B
Go
33 lines
532 B
Go
package asynqmon_test
|
|
|
|
import (
|
|
"embed"
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/hibiken/asynq"
|
|
"github.com/hibiken/asynqmon"
|
|
)
|
|
|
|
//go:embed ui-assets/*
|
|
var staticContents embed.FS
|
|
|
|
func ExampleNewAPI() {
|
|
api := asynqmon.NewAPI(asynqmon.APIOptions{
|
|
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
|
|
StaticContentHandler: asynqmon.NewStaticContentHandler(
|
|
staticContents,
|
|
"ui-assets",
|
|
"index.html",
|
|
),
|
|
})
|
|
defer api.Close()
|
|
|
|
srv := &http.Server{
|
|
Handler: api,
|
|
Addr: ":8080",
|
|
}
|
|
|
|
log.Fatal(srv.ListenAndServe())
|
|
}
|