2
0
mirror of https://github.com/hibiken/asynqmon.git synced 2026-04-20 00:07:12 +08:00
Files
asynqmon/example_test.go

31 lines
506 B
Go
Raw Normal View History

2021-10-03 07:34:21 +05:30
package asynqmon_test
import (
"log"
"net/http"
2021-10-05 11:39:11 +05:30
"github.com/gorilla/mux"
2021-10-03 07:34:21 +05:30
"github.com/hibiken/asynq"
"github.com/hibiken/asynqmon"
)
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"},
})
2021-10-04 20:48:00 +05:30
defer h.Close()
2021-10-03 07:34:21 +05:30
2021-10-05 11:39:11 +05:30
r := mux.NewRouter()
r.PathPrefix("/api").Handler(h)
// Add static content handler or other handlers
// r.PathPrefix("/").Handler(h)
2021-10-03 07:34:21 +05:30
srv := &http.Server{
2021-10-05 11:39:11 +05:30
Handler: r,
2021-10-03 07:34:21 +05:30
Addr: ":8080",
}
log.Fatal(srv.ListenAndServe())
}