more frontend work to set backend port

This commit is contained in:
2021-08-25 23:00:18 -04:00
parent 85d6c610f4
commit b9ee7d0790
9 changed files with 1999 additions and 14 deletions

View File

@@ -9,6 +9,11 @@ import (
"github.com/gofiber/fiber/v2"
)
//Get Server Config
func (s *Server) GetServerConfig(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(fiber.Map{"BasicAuth": s.Config.Authentication.BasicAuth, "Timezone": s.Config.Timezone})
}
// Add a new location
func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
form, err := c.MultipartForm()
@@ -72,7 +77,7 @@ func (s *Server) AddNewLocationHandler(c *fiber.Ctx) error {
if err != nil {
return err
}
return c.SendString(fmt.Sprintf("New Location Created! %s", newLocation.Name))
return c.Status(fiber.StatusOK).SendString(fmt.Sprintf("New Location Created! %s", newLocation.Name))
}
func (s *Server) GetAllLocationsHandler(c *fiber.Ctx) error {
@@ -100,11 +105,11 @@ func (s *Server) GetAllLocationsHandler(c *fiber.Ctx) error {
locArray[0] = testLoc
locArray[1] = testLoc2
fmt.Println("Returning TestLoc: ", locArray)
return c.JSON(locArray)
return c.Status(fiber.StatusOK).JSON(locArray)
}
func (s *Server) DeleteLocationHandler(c *fiber.Ctx) error {
locID := c.Params("locID")
fmt.Println("LocID: ", locID)
return c.JSON(locID)
return c.Status(fiber.StatusOK).JSON(locID)
}