Update README.md
This commit is contained in:
parent
6d4aa27983
commit
61ef0bea4a
@ -331,7 +331,6 @@ func main() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
####Serving static files
|
####Serving static files
|
||||||
|
|
||||||
Use Engine.ServeFiles(path string, root http.FileSystem):
|
Use Engine.ServeFiles(path string, root http.FileSystem):
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -344,6 +343,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Use the following example to serve static files at top level route of your domain. Files are being served from directory ./html.
|
||||||
|
|
||||||
|
```
|
||||||
|
r := gin.Default()
|
||||||
|
r.Use(static.Serve("/", static.LocalFile("html", false)))
|
||||||
|
```
|
||||||
|
|
||||||
Note: this will use `httpNotFound` instead of the Router's `NotFound` handler.
|
Note: this will use `httpNotFound` instead of the Router's `NotFound` handler.
|
||||||
|
|
||||||
####HTML rendering
|
####HTML rendering
|
||||||
|
Loading…
Reference in New Issue
Block a user