csrf/examples/main.go

18 lines
349 B
Go

package main
import (
"net/http"
"code.app-house.ru/go/csrf"
)
func main() {
r := http.NewServeMux()
csrfProtection := csrf.New()
// You can change field or header name (as well as other settings):
// csrfProtection.FormFieldName = "foo"
// csrfProtection.HeaderName = "bar"
http.ListenAndServe(":8000", csrfProtection.Middleware(r))
}