mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-26 08:16:10 +08:00
Merge 4ac1794e3b into 5c48e4e31d
This commit is contained in:
38
README.md
38
README.md
@@ -193,7 +193,7 @@ Next, go to [localhost:8080](http://localhost:8080) and see Asynqmon dashboard:
|
|||||||
|
|
||||||
Asynqmon is also a library which can be imported into an existing web application.
|
Asynqmon is also a library which can be imported into an existing web application.
|
||||||
|
|
||||||
Example with [net/http](https://pkg.go.dev/net/http):
|
### [net/http](https://pkg.go.dev/net/http)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@@ -212,7 +212,7 @@ func main() {
|
|||||||
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
|
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Note: We need the tailing slash when using net/http.ServeMux.
|
// Note: We need the tailing slash when using net/http.ServeMux.
|
||||||
http.Handle(h.RootPath()+"/", h)
|
http.Handle(h.RootPath()+"/", h)
|
||||||
|
|
||||||
// Go to http://localhost:8080/monitoring to see asynqmon homepage.
|
// Go to http://localhost:8080/monitoring to see asynqmon homepage.
|
||||||
@@ -220,7 +220,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Example with [gorilla/mux](https://pkg.go.dev/github.com/gorilla/mux):
|
### [gorilla/mux](https://pkg.go.dev/github.com/gorilla/mux)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@@ -253,8 +253,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Example with [labstack/echo](https://github.com/labstack/echo)):
|
### [labstack/echo](https://github.com/labstack/echo)
|
||||||
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@@ -281,6 +280,35 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### [gofiber/fiber](https://github.com/gofiber/fiber)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/gofiber/adaptor/v2"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/hibiken/asynq"
|
||||||
|
"github.com/hibiken/asynqmon"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := fiber.New(fiber.Config{})
|
||||||
|
|
||||||
|
app.All("/monitoring/tasks/*", adaptor.HTTPHandler(asynqmon.New(asynqmon.Options{
|
||||||
|
RootPath: "/monitoring/tasks",
|
||||||
|
RedisConnOpt: asynq.RedisClientOpt{
|
||||||
|
Addr: ":6379",
|
||||||
|
Password: "",
|
||||||
|
DB: 0,
|
||||||
|
},
|
||||||
|
})))
|
||||||
|
|
||||||
|
log.Fatal(app.Listen(":8080"))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user