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