Add version endpoint (#146)

This commit is contained in:
httpjamesm 2024-07-25 10:51:05 -07:00 committed by GitHub
parent 4c971f3121
commit 1a7635ccef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -86,6 +86,8 @@ func main() {
r.GET("/proxy", routes.GetImage)
r.GET("/version", routes.GetVersion)
soPingCheck := checks.NewPingCheck("https://stackoverflow.com", "GET", 5000, nil, nil)
sePingCheck := checks.NewPingCheck("https://stackexchange.com", "GET", 5000, nil, nil)
healthcheck.New(r, config.DefaultConfig(), []checks.Check{soPingCheck, sePingCheck})

10
src/routes/version.go Normal file
View File

@ -0,0 +1,10 @@
package routes
import (
"anonymousoverflow/config"
"github.com/gin-gonic/gin"
)
func GetVersion(c *gin.Context) {
c.String(200, config.Version)
}