ref: 9bb99dda673271328bf65b4d4fa43b32875aa3a4
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 30 31 32 33 34 35 36 37 38 39 |
/** * Yats - yats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli <kevwe.com> * @copyright Paolo Lulli 2024 */ package main import ( "yats-server/config" "yats-server/rest" "github.com/gin-gonic/gin" ) func RestService(c config.Configuration) { // session = DB address := c.RestAddress router := gin.Default() router.Use(CorsHeaders()) router.SetTrustedProxies([]string{"127.0.0.1"}) gin.SetMode(gin.ReleaseMode) router.POST("/metric", rest.WriteMetricAt) router.POST("/metric/get", rest.GetMetrics) router.POST("/event", rest.WriteEventcAt) router.POST("/event/get", rest.GetEvents) router.Run(address) //router.RunTLS(address, c.CertFile, c.KeyFile) } |