From 96f3a7607ffbdb349a4c2eff35efdf11b8d35a4e Mon Sep 17 00:00:00 2001 From: tjpcc Date: Tue, 10 Jan 2023 13:46:35 -0700 Subject: Add a CGI contrib --- examples/fileserver/main.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'examples/fileserver/main.go') diff --git a/examples/fileserver/main.go b/examples/fileserver/main.go index 01d22ee..d7f628b 100644 --- a/examples/fileserver/main.go +++ b/examples/fileserver/main.go @@ -3,7 +3,6 @@ package main import ( "context" "log" - "net" "os" "tildegit.org/tjp/gus/contrib/fs" @@ -21,12 +20,6 @@ func main() { log.Fatal(err) } - // set up the network listen - listener, err := net.Listen("tcp4", ":1965") - if err != nil { - 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" @@ -42,7 +35,11 @@ func main() { handler = guslog.Requests(os.Stdout, nil)(handler) // run the server - gemini.NewServer(context.Background(), tlsconf, listener, handler).Serve() + server, err := gemini.NewServer(context.Background(), tlsconf, "tcp4", ":1965", handler) + if err != nil { + log.Fatal(err) + } + server.Serve() } func envConfig() (string, string) { -- cgit v1.2.3