From 772d7d299722bda58e71abbd6e64d88836e12c92 Mon Sep 17 00:00:00 2001 From: dickeyxxx Date: Sun, 6 Jul 2014 15:18:54 -0700 Subject: [PATCH] added example on using Static --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 53efb20..dc9b1a8 100644 --- a/README.md +++ b/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 Using LoadHTMLTemplates()