diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-10 13:46:35 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-10 13:46:35 -0700 |
commit | 96f3a7607ffbdb349a4c2eff35efdf11b8d35a4e (patch) | |
tree | 8f1755bd3f3aedf33784f66aab9feccdd36c165e /examples/cowsay | |
parent | db7b6ef07254d61dee46a863786458e15a6459f6 (diff) |
Add a CGI contrib
Diffstat (limited to 'examples/cowsay')
-rw-r--r-- | examples/cowsay/main.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/examples/cowsay/main.go b/examples/cowsay/main.go index e724421..be81f50 100644 --- a/examples/cowsay/main.go +++ b/examples/cowsay/main.go @@ -5,7 +5,6 @@ import ( "context" "io" "log" - "net" "os" "os/exec" @@ -23,17 +22,15 @@ func main() { log.Fatal(err) } - // set up the network listener - listener, err := net.Listen("tcp4", ":1965") - if err != nil { - log.Fatal(err) - } - // add request logging to the request handler handler := guslog.Requests(os.Stdout, nil)(cowsayHandler) // 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 cowsayHandler(ctx context.Context, req *gemini.Request) *gemini.Response { |