Initial commit

This commit is contained in:
Sasha Koshka
2023-05-25 18:08:56 -04:00
commit c300567c0c
51 changed files with 42251 additions and 0 deletions

BIN
examples/image/fractal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

26
examples/image/main.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import "log"
import "net/http"
import "crypto/tls"
import "hnakra/service"
func main () {
http.HandleFunc("/fractal.png", func (res http.ResponseWriter, req *http.Request) {
// An interesting quirk relating to http.ServeFile: there needs
// to be a one-to-one correspondance between pattern path and
// file. This means you can't serve an image on a rooted
// subtree. Otherwise it will randomly fail. I think this has to
// do with how *something* is caching the file.
http.ServeFile(res, req, "fractal.png")
})
err := (&service.HTTP { Mount: service.Mount {
Path: "/fractal.png",
Name: "Image",
Description: "Displays an image of a fractal.",
TLSConfig: &tls.Config { InsecureSkipVerify: true },
}}).Run()
if err != nil { log.Println("XXX", err) }
}