fwhezfwhez / tcpx

a cross-language tcp framwork in golang
MIT License
236 stars 45 forks source link

[Promotion]Profile usage of anchor middleware #33

Open fwhezfwhez opened 4 years ago

fwhezfwhez commented 4 years ago

Hello, TCPX now provides well practice on anchor middleware, which now can get called without times limit. In the old version, operation below is not allowed:

srv.Use("middle1", middle1)
srv.AddHandler()
srv.UnUse("middle1")

srv.Use("middle1")
...
srv.UnUse("middle1")

Because the same middleware cant't use twice.

Now it's promoted and you can use it well like:

srv.Use("middle1", middle1)
srv.AddHandler()
srv.UnUse("middle1")

srv.Use("middle1")
srv.AddHandler()
srv.AddHandler()
srv.UnUse("middle1")

This promotion is linked below