@@ -22,16 +22,22 @@ func main() {
22
22
//设置gzip开关
23
23
//app.SetEnabledGzip(true)
24
24
25
- //设置路由
26
- InitRoute (app .HttpServer )
27
25
28
26
//InitModule(app)
29
27
30
28
//app.UseRequestLog()
31
29
app .Use (
32
30
NewAccessFmtLog ("app" ),
33
31
)
34
- app .ExcludeUse (NewAccessFmtLog ("appex" ), "/" , "/" )
32
+ exAccessFmtLog := NewAccessFmtLog ("appex" )
33
+ exAccessFmtLog .Exclude ("/index" )
34
+ exAccessFmtLog .Exclude ("/v1/machines/queryIP/:IP" )
35
+ app .Use (exAccessFmtLog )
36
+
37
+ app .ExcludeUse (NewAccessFmtLog ("appex1" ), "/" )
38
+
39
+ //设置路由
40
+ InitRoute (app .HttpServer )
35
41
36
42
//启动 监控服务
37
43
app .SetPProfConfig (true , 8081 )
@@ -50,13 +56,16 @@ func main() {
50
56
func Index (ctx dotweb.Context ) error {
51
57
ctx .Response ().Header ().Set ("Content-Type" , "text/html; charset=utf-8" )
52
58
//fmt.Println(time.Now(), "Index Handler")
53
- err := ctx .WriteString ("index => " , fmt . Sprint ( ctx .RouterNode ().Middlewares () ))
59
+ err := ctx .WriteString ("index => " , ctx .Request ().Url ( ))
54
60
fmt .Println (ctx .RouterNode ().GroupMiddlewares ())
55
61
return err
56
62
}
57
63
58
64
func InitRoute (server * dotweb.HttpServer ) {
59
65
server .Router ().GET ("/" , Index )
66
+ server .Router ().GET ("/index" , Index )
67
+ server .Router ().GET ("/v1/machines/queryIP/:IP" , Index )
68
+ server .Router ().GET ("/v1/machines/queryIP2" , Index )
60
69
server .Router ().GET ("/use" , Index ).Use (NewAccessFmtLog ("Router-use" ))
61
70
62
71
g := server .Group ("/group" ).Use (NewAccessFmtLog ("group" )).Use (NewSimpleAuth ("admin" ))
0 commit comments