✨ Check password
This commit is contained in:
parent
072031f86c
commit
c67e970b2f
4 changed files with 24 additions and 2 deletions
17
main.go
17
main.go
|
|
@ -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"))
|
||||
|
|
|
|||
Reference in a new issue