mirror of
https://github.com/wonli/aqi.git
synced 2025-09-26 20:51:23 +08:00
23 lines
365 B
Cheetah
23 lines
365 B
Cheetah
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/wonli/aqi/ws"
|
|
"time"
|
|
|
|
"{{.PackageName}}/internal/middlewares"
|
|
)
|
|
|
|
func Api(g *gin.Engine) {
|
|
g.Use(middlewares.GinCORS())
|
|
g.GET("/ok", func(c *gin.Context) {
|
|
c.JSON(200, gin.H{
|
|
"t": time.Now().Unix(),
|
|
})
|
|
})
|
|
|
|
g.GET("/ws", func(c *gin.Context) {
|
|
ws.HttpHandler(c.Writer, c.Request)
|
|
})
|
|
}
|