mirror of
https://gitea.com/action-examples/Go.git
synced 2026-03-27 08:30:06 +00:00
feat: add new router and ping route to main application
- Remove the import statement for "github.com/gin-gonic/gin" in main.go - Add a new file called router.go in the router directory - Create a new function called New() in router.go that returns a *gin.Engine - Add a GET route for "/ping" in the New() function in router.go Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
11
router/router.go
Normal file
11
router/router.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package router
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
func New() *gin.Engine {
|
||||
r := gin.Default()
|
||||
r.GET("/ping", func(c *gin.Context) {
|
||||
c.String(200, "pong")
|
||||
})
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user