16 Star 61 Fork 23

DiDi-opensource / falcon-log-agent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
http.go 738 Bytes
一键复制 编辑 原始数据 按行查看 历史
gaojiasheng 提交于 2018-08-23 20:07 . add check api
package http
import (
"fmt"
"net/http"
"github.com/didi/falcon-log-agent/common/g"
"github.com/didi/falcon-log-agent/strategy"
"github.com/didi/falcon-log-agent/worker"
"github.com/gin-gonic/gin"
)
// Start http api
func Start() {
router := gin.Default()
router.GET("/health", func(c *gin.Context) {
c.JSON(http.StatusOK, "ok")
})
router.GET("/strategy", func(c *gin.Context) {
c.JSON(http.StatusOK, strategy.GetListAll())
})
router.GET("/cached", func(c *gin.Context) {
c.String(http.StatusOK, worker.GetCachedAll())
})
router.POST("/check", func(c *gin.Context) {
log := c.PostForm("log")
c.JSON(http.StatusOK, CheckLogByStrategy(log))
})
router.Run(fmt.Sprintf("0.0.0.0:%d", g.Conf().Http.HTTPPort))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/didiopensource/falcon-log-agent.git
git@gitee.com:didiopensource/falcon-log-agent.git
didiopensource
falcon-log-agent
falcon-log-agent
542bf9e4eb8b

搜索帮助

344bd9b3 5694891 D2dac590 5694891