♻️ Anonymous structs are cool
This commit is contained in:
parent
2ac49565fd
commit
673b42394c
2 changed files with 3 additions and 9 deletions
|
|
@ -7,10 +7,6 @@ import (
|
||||||
"github.com/gofiber/fiber/v2/middleware/logger"
|
"github.com/gofiber/fiber/v2/middleware/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type passReq struct {
|
|
||||||
Pass string `json:"pass"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() *fiber.App {
|
func New() *fiber.App {
|
||||||
app := fiber.New()
|
app := fiber.New()
|
||||||
conf := config.GetConfig()
|
conf := config.GetConfig()
|
||||||
|
|
@ -31,7 +27,9 @@ func New() *fiber.App {
|
||||||
})
|
})
|
||||||
|
|
||||||
app.Post("/check_pass", func(c *fiber.Ctx) error {
|
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 {
|
if err := c.BodyParser(req); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@ import (
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type passReq struct {
|
|
||||||
Pass string `json:"pass"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func run(cmd *cobra.Command, args []string) {
|
func run(cmd *cobra.Command, args []string) {
|
||||||
app := web.New()
|
app := web.New()
|
||||||
log.Fatal(app.Listen(":3000"))
|
log.Fatal(app.Listen(":3000"))
|
||||||
|
|
|
||||||
Reference in a new issue