mtfosbot/router/routes/routes.go
2018-08-14 17:25:34 +08:00

28 lines
439 B
Go

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",
})
})
}