Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能不能为静态目录专门增加一个设置路径的方法? #125

Closed
biij5698 opened this issue Jun 7, 2018 · 2 comments
Closed

Comments

@biij5698
Copy link

biij5698 commented Jun 7, 2018

1、app.HttpServer.ServerFile("/static/filepath", "static")能不能把星号后面的filepath去掉?因为星号就代表全部了。
2、最好能增加一个设置静态目录的方法,参数里面直接填写静态目录的路径即可(要支持相对路径),然后一个可选参数是数组形式,比如{"
.css","*.png"},用于指定允许的静态文件类型。

devfeel added a commit that referenced this issue Dec 3, 2018
* New Feature: Add Request.RealIP used to returns the first ip from 'X-Forwarded-For' or 'X-Real-IP' header key, fixed for #164
* New Feature: route.ServerFile support '*filepath' or '/*', to simplify register static file router, fixed for #125
* Example:
``` golang
app.HttpServer.ServerFile("/*", "D:/gotmp")
```
* update example/main
* 2018-12-03 15:00
devfeel added a commit that referenced this issue Dec 3, 2018
* New Feature: Add Request.RealIP used to returns the first ip from 'X-Forwarded-For' or 'X-Real-IP' header key, fixed for #164
* New Feature: route.ServerFile support '*filepath' or '/*', to simplify register static file router, fixed for #125
* Example:
``` golang
app.HttpServer.ServerFile("/*", "D:/gotmp")
```
* update example/main
* 2018-12-03 15:00
@devfeel
Copy link
Owner

devfeel commented Dec 3, 2018

It is now supported in version 1.5.9.1

devfeel added a commit that referenced this issue Nov 3, 2019
* New Feature: HttpServer.RegisterServerFile增加excludeExtension参数,用于设置不希望被访问的文件后缀名
* Update: 增加ErrNotFound
* About HttpServer.RegisterServerFile:
    - Demo: server.RegisterServerFile(RouteMethod_GET, "/src/*", "/var/www", nil)
    - Demo: server.RegisterServerFile(RouteMethod_GET, "/src/*filepath", "/var/www", []string{".zip", ".rar"})
    - 当设置excludeExtension为nil时,可访问所有文件
    - 本次更新涉及API变更
* Fixed for issue #125 & #212
* 2019-11-04 01:00 at ShangHai
@devfeel
Copy link
Owner

devfeel commented Nov 3, 2019

目前在v1.7.4支持在注册静态资源路由时指定屏蔽哪些后缀名,可以满足你的需求

@devfeel devfeel closed this as completed Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants