admin: Use gin-gonic as router
This commit is contained in:
parent
83468ad723
commit
8b3fbdb64a
32 changed files with 2785 additions and 1635 deletions
|
@ -1,13 +1,15 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"github.com/julienschmidt/httprouter"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func init() {
|
||||
router.GET("/api/version", apiHandler(showVersion))
|
||||
func DeclareVersionRoutes(router *gin.RouterGroup) {
|
||||
router.GET("/version", showVersion)
|
||||
}
|
||||
|
||||
func showVersion(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
return map[string]interface{}{"version": 1.0}, nil
|
||||
func showVersion(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"version": 1.0})
|
||||
}
|
||||
|
|
Reference in a new issue