web: add /api/project endpoint boilerplate
Signed-off-by: Nathan13888 <29968201+Nathan13888@users.noreply.github.com>
This commit is contained in:
parent
a15609caaf
commit
4ea9f00059
|
@ -5,8 +5,10 @@ import "github.com/gofiber/fiber/v2"
|
||||||
func StartServer() error {
|
func StartServer() error {
|
||||||
app := fiber.New()
|
app := fiber.New()
|
||||||
|
|
||||||
|
// TODO: authentication middleware? is it needed?
|
||||||
|
|
||||||
app.Get("/", func(c *fiber.Ctx) error {
|
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("/health", getHealth)
|
||||||
app.Get("/healthz", getHealth)
|
app.Get("/healthz", getHealth)
|
||||||
|
@ -14,11 +16,23 @@ func StartServer() error {
|
||||||
|
|
||||||
app.Get("/status", getStatus)
|
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
|
app.Listen(":4200") // TODO: custom port and address
|
||||||
|
|
||||||
return nil
|
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 {
|
func getHealth(c *fiber.Ctx) error {
|
||||||
return c.SendStatus(200)
|
return c.SendStatus(200)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue