From d1eb3b14852d270e619f3f5d41b3c0ab358b01f3 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Thu, 26 Jun 2025 11:07:20 +0500 Subject: [PATCH] Add examples directory --- examples/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/main.go diff --git a/examples/main.go b/examples/main.go new file mode 100644 index 0000000..75d0a59 --- /dev/null +++ b/examples/main.go @@ -0,0 +1,18 @@ +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)) +}