♻️ Anonymous structs are cool

This commit is contained in:
Dan Jones 2023-03-27 20:48:25 -05:00
commit 673b42394c
2 changed files with 3 additions and 9 deletions

View file

@ -7,10 +7,6 @@ import (
"github.com/gofiber/fiber/v2/middleware/logger"
)
type passReq struct {
Pass string `json:"pass"`
}
func New() *fiber.App {
app := fiber.New()
conf := config.GetConfig()
@ -31,7 +27,9 @@ func New() *fiber.App {
})
app.Post("/check_pass", func(c *fiber.Ctx) error {
req := new(passReq)
req := new(struct {
Pass string `json:"pass"`
})
if err := c.BodyParser(req); err != nil {
panic(err)
}

View file

@ -6,10 +6,6 @@ import (
"log"
)
type passReq struct {
Pass string `json:"pass"`
}
func run(cmd *cobra.Command, args []string) {
app := web.New()
log.Fatal(app.Listen(":3000"))