### 靜態文件
圖片,JavaScript,CSS,PDF,字體文件等等…
使用 DotWeb.HttpServer#ServerFile()
ServerFile(path string, fileRoot string) RouterNode
#### 用法:
~~~
app := dotweb.New()
app.HttpServer.ServerFile("/static/*filepath", "/wwworrt/public")
~~~
這樣會將所有訪問/static/*的請求去訪問/wwworrt/public目錄。例如,一個訪問/static/js/main.js的請求會匹配到/wwworrt/public/js/main.js這個文件。
#### 自定義設置:
設置是否允許目錄瀏覽
通過DotWeb.HttpServer#SetEnabledListDir()設置
// SetEnabledListDir 設置是否允許目錄瀏覽,默認為false
SetEnabledListDir(isEnabled bool)
#### 用法:
~~~
app := dotweb.New()
app.HttpServer.SetEnabledListDir(false)
app.HttpServer.ServerFile("/static/*filepath", "/wwworrt/public")
~~~
這樣會禁止所有目錄瀏覽訪問,比如單獨訪問/static/ 將會返回空