This commit is contained in:
Jay 2018-04-10 18:32:34 +08:00
parent d071a26131
commit fdfae04892
2 changed files with 33 additions and 0 deletions

13
main.go Normal file
View File

@ -0,0 +1,13 @@
package main
import (
"git.trj.tw/golang/go-gallery/modules/routes"
"github.com/gin-gonic/gin"
)
var server *gin.Engine
func main() {
server = routes.NewServ()
server.Run(":10230")
}

20
modules/routes/routes.go Normal file
View File

@ -0,0 +1,20 @@
package routes
import (
"github.com/gin-gonic/gin"
)
// NewServ - get new service
func NewServ() *gin.Engine {
r := gin.Default()
return r
}
// SetDefaultRoutes - set default
func SetDefaultRoutes(r *gin.Engine) {
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "test",
})
})
}