Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

tango Group 与 Static 配合使用的问题 #34

Open
qjebbs opened this issue Aug 19, 2016 · 1 comment
Open

tango Group 与 Static 配合使用的问题 #34

qjebbs opened this issue Aug 19, 2016 · 1 comment

Comments

@qjebbs
Copy link

qjebbs commented Aug 19, 2016

假设有以下代码

t := tango.Classic()
g := tango.NewGroup()
g.Use(tango.Static(tango.StaticOptions{
    RootPath:   "./admin",
    Prefix:     "/",
    IndexFiles: []string{"index.html"},
}))
t.Group("/admin", g)
t.Run(":80")

运行后,无论访问http://localhost/还是http://localhost/admin/都是404。这个似乎不符合直觉。

从这个代码来说,把 tango.StaticPrefix 设成/admin似乎也达成目的。但我这么做的初衷是希望给 http://localhost/admin/ 做中间件,特别地控制它的权限。

@lunny
Copy link
Owner

lunny commented Aug 19, 2016

目前确实不支持,全局中间件是无论如何都会执行的,但是Group中间件和Action中间件只有路由请求才会执行。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants