package main
import (
"github.com/sczhaoyu/panda"
)
func index(c *panda.Controller) {
c.SetSession("hello", "world") //设置session
c.Write([]byte("hello world"))
}
func interceptor(c *panda.Controller) bool {
c.Write([]byte("hello interceptor"))
return true
}
func interceptorAfter(c *panda.Controller) bool {
c.Write([]byte("hello interceptorAfter"))
return true
}
func main() {
panda.LocalAddress = ":8080"
panda.HandlerRouter(panda.CASUAL, "/", index)
panda.HandlerRouter(panda.POST, "/post", index)
panda.HandlerRouter(panda.GET, "/get", index)
panda.AddInterceptor(interceptor, panda.BEFORE)
panda.AddInterceptor(interceptor, panda.AFTER)
panda.SessionSwitch = true //session开启
panda.Run()
}
-
Notifications
You must be signed in to change notification settings - Fork 2
sczhaoyu/panda
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Go language http web efficient development tools
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published