MCPcopy Index your code
hub / github.com/caddyserver/certmagic / ExampleHTTPS

Function ExampleHTTPS

doc_test.go:26–35  ·  view source on GitHub ↗

This is the simplest way for HTTP servers to use this package. Call HTTPS() with your domain names and your handler (or nil for the http.DefaultMux), and CertMagic will do the rest.

()

Source from the content-addressed store, hash-verified

24// Call HTTPS() with your domain names and your handler (or nil
25// for the http.DefaultMux), and CertMagic will do the rest.
26func ExampleHTTPS() {
27 http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
28 fmt.Fprintf(w, "Hello, HTTPS visitor!")
29 })
30
31 err := HTTPS([]string{"example.com", "www.example.com"}, nil)
32 if err != nil {
33 log.Fatal(err)
34 }
35}

Callers

nothing calls this directly

Calls 1

HTTPSFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…