add kontor-api-go REST API with Go, Fiber, Bun

This commit is contained in:
Thomas Peetz
2025-11-30 01:50:00 +01:00
parent 836a10e3ef
commit d63120b092
7 changed files with 201 additions and 0 deletions
@@ -0,0 +1,14 @@
package handler
import "github.com/gofiber/fiber/v2"
func SetupComics(app *fiber.App) {
comics := app.Group("/api/comics")
comics.Get("/comics", GetAllComics)
}
func GetAllComics(c *fiber.Ctx) error {
return c.Status(200).JSON(&fiber.Map{
"comics": []string{},
})
}
@@ -0,0 +1,9 @@
package handler
import "github.com/gofiber/fiber/v2"
func GetHealth(c *fiber.Ctx) error {
return c.Status(200).JSON(&fiber.Map{
"status": "ok",
})
}
+21
View File
@@ -0,0 +1,21 @@
package main
import (
"kontor-api-go/cmd/kontor/handler"
"log"
"github.com/gofiber/fiber/v2"
)
func main() {
log.Println("Kontor started")
app := fiber.New()
app.Get("/health", handler.GetHealth)
handler.SetupComics(app)
// Listen on port 8900
app.Listen(":8900")
log.Println("Kontor finished")
}