MCPcopy Create free account
hub / github.com/devfeel/dotweb / InitModule

Function InitModule

example/middleware/main.go:83–103  ·  view source on GitHub ↗
(dotserver *dotweb.HttpServer)

Source from the content-addressed store, hash-verified

81}
82
83func InitModule(dotserver *dotweb.HttpServer) {
84 dotserver.RegisterModule(&dotweb.HttpModule{
85 OnBeginRequest: func(ctx dotweb.Context) {
86 fmt.Println(time.Now(), "HttpModule BeginRequest1:", ctx.Request().RequestURI)
87 },
88 OnEndRequest: func(ctx dotweb.Context) {
89 fmt.Println(time.Now(), "HttpModule EndRequest1:", ctx.Request().RequestURI)
90 },
91 })
92
93 dotserver.RegisterModule(&dotweb.HttpModule{
94 OnBeginRequest: func(ctx dotweb.Context) {
95 fmt.Println(time.Now(), "HttpModule BeginRequest2:", ctx.Request().RequestURI)
96 },
97 })
98 dotserver.RegisterModule(&dotweb.HttpModule{
99 OnEndRequest: func(ctx dotweb.Context) {
100 fmt.Println(time.Now(), "HttpModule EndRequest3:", ctx.Request().RequestURI)
101 },
102 })
103}
104
105type AccessFmtLog struct {
106 dotweb.BaseMiddleware

Callers

nothing calls this directly

Calls 2

RegisterModuleMethod · 0.80
RequestMethod · 0.65

Tested by

no test coverage detected