Check password

This commit is contained in:
Dan Jones 2023-03-23 21:20:44 -05:00
commit c67e970b2f
4 changed files with 24 additions and 2 deletions

17
main.go
View file

@ -7,12 +7,25 @@ import (
"github.com/gofiber/fiber/v2"
)
type passReq struct {
Pass string `json:"pass"`
}
func main() {
app := fiber.New()
config := config.GetConfig()
conf := config.GetConfig()
app.Get("/", func(c *fiber.Ctx) error {
return c.JSON(&config)
return c.JSON(&conf)
})
app.Post("/check_pass", func(c *fiber.Ctx) error {
req := new(passReq)
if err := c.BodyParser(req); err != nil {
panic(err)
}
return c.JSON(config.CheckPassword(req.Pass))
})
log.Fatal(app.Listen(":3000"))