Add examples directory
This commit is contained in:
parent
c1b1805c6a
commit
d1eb3b1485
1 changed files with 18 additions and 0 deletions
18
examples/main.go
Normal file
18
examples/main.go
Normal file
|
@ -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))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue