csrf/examples/main.go

19 lines
349 B
Go
Raw Normal View History

2025-06-26 11:07:20 +05:00
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))
}