This commit is contained in:
jimmy 2022-09-11 01:22:07 +12:00
parent 76f1b1427f
commit 2801e4ecd3
2 changed files with 5 additions and 1 deletions

View File

@ -4,9 +4,11 @@ import (
"magmise/controllers"
"magmise/models"
"net/http"
"os"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/gorilla/csrf"
)
func main() {
@ -20,5 +22,6 @@ func main() {
r.Post("/user/{username}", user.Create)
r.Post("/login", controllers.Login)
r.Post("/logout", controllers.Logout)
http.ListenAndServe(":8080", r)
CSRF := csrf.Protect([]byte(os.Getenv("CSRFKEY")))
http.ListenAndServe(":8080", CSRF(r))
}

View File

@ -19,6 +19,7 @@ services:
- GOPATH=/root/go
- HASHKEY=test
- BLOCKKEY=test
- CSRFKEY=test
working_dir: /api
command: go test ./test/...