ref: f79a9d09c451653ff27fb34afb5b0c71dc758a32
server/service-rest.go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
package main import ( "yats-server/config" "yats-server/rest" "github.com/gin-gonic/gin" ) func RestService(c config.Configuration) { // session = DB address := c.REST_ADDRESS router := gin.Default() router.Use(CorsHeaders()) router.SetTrustedProxies([]string{"127.0.0.1"}) gin.SetMode(gin.ReleaseMode) router.POST("/rt/metric", rest.WriteMetricNow) router.POST("/metric", rest.WriteMetricAt) router.POST("/rt/event", rest.WriteEventNow) router.POST("/event", rest.WriteEventcAt) router.Run(address) //router.RunTLS(address, c.CertFile, c.KeyFile) } |