From a1fffd12aa71ef068182ec47a1be22ae00718ec4 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 21 May 2022 15:18:25 -0700 Subject: [PATCH] add api check --- main.go | 2 +- routes/routes.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 90c72bd..2741c87 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( "github.com/gofiber/fiber/v2/middleware/cors" ) -const version string = "\nv0.8.4-Alpha" +const version string = "\nv0.8.5-Alpha" func main() { fmt.Println(version) diff --git a/routes/routes.go b/routes/routes.go index 01c7870..582b358 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -13,6 +13,14 @@ func Setup(app *fiber.App) { // API Handling var routerPrefix string = "/api/v1" + // API check + app.Get(routerPrefix+"/status", func(c *fiber.Ctx) error { + return c.Status(fiber.StatusOK).JSON(fiber.Map{ + "success": true, + "message": "the API is active", + }) + }) + // Student Authentication Handler app.Get(routerPrefix+"/student", controllers.Student) app.Post(routerPrefix+"/student/enroll", controllers.Enroll)