diff options
author | Keuin <[email protected]> | 2023-07-29 21:20:12 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2023-07-29 21:20:12 +0800 |
commit | 110301a975e43739192577166d089e28c22ae266 (patch) | |
tree | e655e00876b0140aa9ad431824765cd1c8371899 /api/server.go | |
parent | e72342b0027752dc93e57ebec99c4eb9a8aa8efe (diff) |
Add API server
Diffstat (limited to 'api/server.go')
-rw-r--r-- | api/server.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/api/server.go b/api/server.go index 4cfe8f4..32e3202 100644 --- a/api/server.go +++ b/api/server.go @@ -2,15 +2,19 @@ package api import ( "github.com/gofiber/fiber/v2" - "github.com/keuin/slbr/logging" + "github.com/keuin/slbr/api/agent" ) -func StartServer(logger logging.Logger, addr string) error { +func StartServer(addr string, a agent.Agent) error { app := fiber.New() app.Get("/", func(c *fiber.Ctx) error { return c.SendString("Hello, World!") }) + app.Get("/tasks", func(c *fiber.Ctx) error { + return c.JSON(a.GetTasks()) + }) + return app.Listen(addr) } |