mtfosbot/router/routes/routes.go

28 lines
439 B
Go
Raw Normal View History

2018-08-14 09:25:34 +00:00
package routes
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
// NewServ - create new gin server
func NewServ() *gin.Engine {
r := gin.New()
// access log
r.Use(gin.Logger())
// error catch
r.Use(gin.Recovery())
// enable cors
r.Use(cors.Default())
return r
}
// SetRoutes - set routes
func SetRoutes(r *gin.Engine) {
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "ok",
})
})
}