💾 Archived View for source.community › ckaznocha › gemini › raw › main › example_test.go captured on 2024-02-05 at 09:58:32.
⬅️ Previous capture (2021-12-17)
-=-=-=-=-=-=-
package gemini_test import ( "context" "fmt" "log" "source.community/ckaznocha/gemini" ) func ExampleServer_ListenAndServeTLS() { s := &gemini.Server{ Handler: gemini.HandlerFunc(func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) { fmt.Fprintln(w.Success(ctx, ""), "Hello, TLS!") }), } // One can use generate_cert.go in crypto/tls to generate cert.pem and key.pem. log.Printf("About to listen the default port. Go to gemini://127.0.0.1/") err := s.ListenAndServeTLS("", "cert.pem", "key.pem") log.Fatal(err) }