Rename App -> Server, less confusing

This commit is contained in:
Imbus 2024-02-29 20:02:13 +01:00
parent 568fb0323e
commit 4d510e5c51

View file

@ -42,20 +42,20 @@ func main() {
database.DbConnect(conf.DbPath) database.DbConnect(conf.DbPath)
app := fiber.New() server := fiber.New()
app.Static("/", "./static") server.Static("/", "./static")
b := &ButtonState{PressCount: 0} b := &ButtonState{PressCount: 0}
app.Get("/api/button", b.pressHandlerGet) server.Get("/api/button", b.pressHandlerGet)
app.Post("/api/button", b.pressHandlerPost) server.Post("/api/button", b.pressHandlerPost)
app.Post("/api/project", func(c *fiber.Ctx) error { server.Post("/api/project", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{ return c.JSON(fiber.Map{
"message": "Project created", "message": "Project created",
}) })
}) })
err = app.Listen(fmt.Sprintf(":%d", conf.Port)) err = server.Listen(fmt.Sprintf(":%d", conf.Port))
if err != nil { if err != nil {
fmt.Println("Error starting server: ", err) fmt.Println("Error starting server: ", err)
} }