asynqmon/example_test.go
2021-10-12 15:35:56 -07:00

31 lines
506 B
Go

package asynqmon_test
import (
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/hibiken/asynq"
"github.com/hibiken/asynqmon"
)
func ExampleNew() {
h := asynqmon.New(asynqmon.Options{
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
})
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: r,
Addr: ":8080",
}
log.Fatal(srv.ListenAndServe())
}