Add GET /api/status for Ripple's status page.

This commit is contained in:
Howl 2016-04-10 23:14:44 +02:00
parent 0418adc8c3
commit 189a0cbb02
2 changed files with 20 additions and 0 deletions

17
app/internals/status.go Normal file
View File

@ -0,0 +1,17 @@
// Package internals has methods that suit none of the API packages.
package internals
import (
"github.com/gin-gonic/gin"
)
type statusResponse struct {
Response int `json:"response"`
}
// Status is used for checking the API is up by the ripple website, on the status page.
func Status(c *gin.Context) {
c.JSON(200, statusResponse{
Response: 1,
})
}

View File

@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/contrib/gzip"
"github.com/gin-gonic/gin"
"github.com/osuripple/api/app/internals"
"github.com/osuripple/api/app/v1"
"github.com/osuripple/api/common"
)
@ -54,6 +55,8 @@ func Start(conf common.Conf, db *sql.DB) *gin.Engine {
gv1.GET("/meta/up_since", Method(v1.MetaUpSinceGET, db, common.PrivilegeAPIMeta))
gv1.GET("/meta/update", Method(v1.MetaUpdateGET, db, common.PrivilegeAPIMeta))
}
api.GET("/status", internals.Status)
}
r.NoRoute(v1.Handle404)