aboutsummaryrefslogtreecommitdiff
path: root/lib/http
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2021-01-10 03:32:27 +0700
committerShulhan <m.shulhan@gmail.com>2021-01-10 03:32:27 +0700
commit1373f13ff53bdc2bfa14a44173c203449baecb4b (patch)
treeee750e9f7c403a4a527d4beb5f7110a94e0b8b5a /lib/http
parent58428b6d7ba5f8c50ecd30c18d4679bc9b932ac3 (diff)
downloadpakakeh.go-1373f13ff53bdc2bfa14a44173c203449baecb4b.tar.xz
http: update documentation on how to use memory file system
Diffstat (limited to 'lib/http')
-rw-r--r--lib/http/http.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/http/http.go b/lib/http/http.go
index 30eca705..a80ceb4e 100644
--- a/lib/http/http.go
+++ b/lib/http/http.go
@@ -50,10 +50,18 @@
// This cause more memory to be consumed on server side but we minimize path
// lookup, and cache-miss on OS level.
//
-// Serving file system is handled by memory file system using map of path to
-// file node.
+// Serving file system is handled by package memfs, which can be set on
+// ServerOptions.
+// For example, to serve all content in directory "www", we can set the
+// ServerOptions to,
//
-// map[/index.html] = Node{Type: ..., Size: ..., ContentType: ...}
+// opts := &http.ServerOptions{
+// Options: memfs.Options{
+// Root: "www",
+// },
+// Address: ":8080",
+// }
+// httpServer, err := NewServer(opts)
//
// There is a limit on size of file to be mapped on memory.
// See the package "lib/memfs" for more information.