From 775c0c1040e6a6622fec39d49b354bfa194a6998 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Sat, 30 Sep 2023 20:08:33 -0600 Subject: 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 --- examples/fileserver/main.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'examples/fileserver') 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 /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{} -- cgit v1.2.3