mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
Update README.md : example with gin framework
This commit is contained in:
parent
d1b889456d
commit
9d06847248
38
README.md
38
README.md
@ -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.
|
||||||
@ -253,7 +253,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Example with [labstack/echo](https://github.com/labstack/echo)):
|
Example with [labstack/echo](https://github.com/labstack/echo):
|
||||||
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -266,7 +266,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
|
|
||||||
mon := asynqmon.New(asynqmon.Options{
|
mon := asynqmon.New(asynqmon.Options{
|
||||||
RootPath: "/monitoring/tasks",
|
RootPath: "/monitoring/tasks",
|
||||||
@ -282,6 +282,38 @@ func main() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Example with [gin-gonic/gin](https://github.com/gin-gonic/gin):
|
||||||
|
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/hibiken/asynq"
|
||||||
|
"github.com/hibiken/asynqmon"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
h := asynqmon.New(asynqmon.Options{
|
||||||
|
RootPath: "/monitoring",
|
||||||
|
RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"},
|
||||||
|
})
|
||||||
|
|
||||||
|
r := gin.Default()
|
||||||
|
|
||||||
|
r.Any(h.RootPath()+"/*any", gin.WrapH(h))
|
||||||
|
|
||||||
|
if err := r.Run(":8080"); err != nil {
|
||||||
|
log.Fatal("Server failed to start:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) 2019-present [Ken Hibino](https://github.com/hibiken) and [Contributors](https://github.com/hibiken/asynqmon/graphs/contributors). `Asynqmon` is free and open-source software licensed under the [MIT License](https://github.com/hibiken/asynq/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/publicdomain/zero/1.0/) license (CC0 1.0 Universal).
|
Copyright (c) 2019-present [Ken Hibino](https://github.com/hibiken) and [Contributors](https://github.com/hibiken/asynqmon/graphs/contributors). `Asynqmon` is free and open-source software licensed under the [MIT License](https://github.com/hibiken/asynq/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/publicdomain/zero/1.0/) license (CC0 1.0 Universal).
|
||||||
|
Loading…
Reference in New Issue
Block a user