Skip to content
Myr

Merge pull request #46 from dickeyxxx/readme/not-found

Before adoption: this commit came in with the history the project adopted, so no landing records it.

added example on using ServeFiles

authored by Javier Provecho Fernandez · committed by Javier Provecho Fernandez · parents 220f8ba, 772d7d2 · Browse files · 1 file+16 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−0 removed

  • other:+16 added−0 removed

1 file+16 added−0 removed

modified:README.md+16 added
285 unmodified lines
286}287```288289290####Serving static files291292Use Engine.ServeFiles(path string, root http.FileSystem):293294```go295func main() {296 r := gin.Default()297 r.Static("/assets", "./assets")298299 // Listen and server on 0.0.0.0:8080300 r.Run(":8080")301}302```303304Note: this will use `httpNotFound` instead of the Router's `NotFound` handler.305306####HTML rendering307308Using LoadHTMLTemplates()309
179 unmodified lines