first
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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",
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user