web: add /api/project endpoint boilerplate

Signed-off-by: Nathan13888 <29968201+Nathan13888@users.noreply.github.com>
This commit is contained in:
Nathan Chung 2023-05-23 18:50:47 -04:00
parent a15609caaf
commit 4ea9f00059
Signed by: n4chung
SSH Key Fingerprint: SHA256:/+NqYA5MfQIjjfwa4z16mw3Y+lxgY/Ml8wCeGnh6qBU
1 changed files with 15 additions and 1 deletions

View File

@ -5,8 +5,10 @@ import "github.com/gofiber/fiber/v2"
func StartServer() error {
app := fiber.New()
// TODO: authentication middleware? is it needed?
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World 👋!")
return c.SendString("Hi! Why are you here? :)")
})
app.Get("/health", getHealth)
app.Get("/healthz", getHealth)
@ -14,11 +16,23 @@ func StartServer() error {
app.Get("/status", getStatus)
app.Get("/api/project/:proj/all", getProjectAll)
app.Get("/api/project/:proj/status", getProjectStatus)
// TODO: initiate re-checks?
app.Listen(":4200") // TODO: custom port and address
return nil
}
func getProjectAll(c *fiber.Ctx) error {
return c.SendStatus(200)
}
func getProjectStatus(c *fiber.Ctx) error {
return c.SendStatus(200)
}
func getHealth(c *fiber.Ctx) error {
return c.SendStatus(200)
}