Skip to content
Myr

added example on using Static

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

authored by dickeyxxx · committed by dickeyxxx · parent 5eb0e10 · 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
234 unmodified lines
235}236```237238239####Serving static files240241Use Engine.ServeFiles(path string, root http.FileSystem):242243```go244func main() {245 r := gin.Default()246 r.Static("/assets", "./assets")247248 // Listen and server on 0.0.0.0:8080249 r.Run(":8080")250}251```252253Note: this will use `httpNotFound` instead of the Router's `NotFound` handler.254255####HTML rendering256257Using LoadHTMLTemplates()258
94 unmodified lines