mirror of https://github.com/gin-gonic/gin.git
added example on using Static
This commit is contained in:
parent
5eb0e10a78
commit
772d7d2997
16
README.md
16
README.md
|
@ -236,6 +236,22 @@ func main() {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
####Serving static files
|
||||||
|
|
||||||
|
Use Engine.ServeFiles(path string, root http.FileSystem):
|
||||||
|
|
||||||
|
```go
|
||||||
|
func main() {
|
||||||
|
r := gin.Default()
|
||||||
|
r.Static("/assets", "./assets")
|
||||||
|
|
||||||
|
// Listen and server on 0.0.0.0:8080
|
||||||
|
r.Run(":8080")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: this will use `httpNotFound` instead of the Router's `NotFound` handler.
|
||||||
|
|
||||||
####HTML rendering
|
####HTML rendering
|
||||||
|
|
||||||
Using LoadHTMLTemplates()
|
Using LoadHTMLTemplates()
|
||||||
|
|
Loading…
Reference in New Issue