12345678910111213141516171819202122232425262728 |
- package web
- import (
- _ "embed"
- "github.com/fgm/izidic"
- "github.com/gin-gonic/gin"
- "code.osinet.fr/fgm/sqs_demo/services"
- "code.osinet.fr/fgm/sqs_demo/services/redriver"
- )
- //go:embed public/redriver.css
- var css []byte
- func SetupRoutes(rd redriver.Redriver) *gin.Engine {
- r := gin.Default()
- r.SetTrustedProxies(nil)
- r.GET("/", makeHomeHandler(rd))
- r.GET("/public/redriver.css", func(c *gin.Context) { c.Writer.Write(css) })
- r.GET("/queue/:name", makeQueueHandler(rd))
- return r
- }
- func HttpService(dic *izidic.Container) (any, error) {
- rd := dic.MustService(services.SvcRedriver).(redriver.Redriver)
- return SetupRoutes(rd), nil
- }
|