GET / was changed to POST / for a new CAPTCHA creation. And now captcha db is being initialised in handlers.

This commit is contained in:
Alexander Andreev 2022-10-20 22:50:49 +04:00
parent aa6534aa98
commit b155900579
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -3,7 +3,6 @@ package main
import (
"flag"
"fmt"
"justcaptcha/internal/captcha"
"justcaptcha/internal/handlers"
"justcaptcha/pkg/server"
"log"
@ -30,12 +29,10 @@ func main() {
return
}
captcha.Init(*captchaExpiry)
hand := handlers.New()
hand := handlers.New(*captchaExpiry)
srv := server.NewHttpServer()
srv.GET("/", hand.New)
srv.POST("/", hand.New)
srv.POST("/:captcha", hand.Solve)
srv.GET("/:captcha", hand.IsSolved)
srv.GET("/:captcha/image", hand.Image)