summaryrefslogtreecommitdiff
path: root/examples/fileserver
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-30 20:08:33 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-30 20:08:53 -0600
commit775c0c1040e6a6622fec39d49b354bfa194a6998 (patch)
treef46edde7ee0392ae714f4facfd4e64244814c040 /examples/fileserver
parent09c482d5016cfc7b628058893a1644fdf5fa699f (diff)
file serving refactor
* do away with fs.FS usage in gemini, like the previous refactor in gopher * remove spartan code in contrib * standardize fsroot/urlroot string arguments to file serving handlers
Diffstat (limited to 'examples/fileserver')
-rw-r--r--examples/fileserver/main.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/fileserver/main.go b/examples/fileserver/main.go
index c374cc4..e90fdd9 100644
--- a/examples/fileserver/main.go
+++ b/examples/fileserver/main.go
@@ -21,16 +21,14 @@ func main() {
log.Fatal(err)
}
- // build the request handler
- fileSystem := os.DirFS(".")
// Fallthrough tries each handler in succession until it gets something other than "51 Not Found"
handler := sr.FallthroughHandler(
// first see if they're fetching a directory and we have <dir>/index.gmi
- fs.GeminiDirectoryDefault(fileSystem, "index.gmi"),
+ fs.GeminiDirectoryDefault(".", "", "index.gmi"),
// next (still if they requested a directory) build a directory listing response
- fs.GeminiDirectoryListing(fileSystem, nil),
+ fs.GeminiDirectoryListing(".", "", nil),
// finally, try to find a file at the request path and respond with that
- fs.GeminiFileHandler(fileSystem),
+ fs.GeminiFileHandler(".", ""),
)
router := &sr.Router{}