33 lines
474 B
Go
33 lines
474 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"embed"
|
||
|
"io/fs"
|
||
|
"log"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
var version = "development"
|
||
|
|
||
|
//go:embed public/*
|
||
|
var embeddedPublic embed.FS
|
||
|
|
||
|
func main() {
|
||
|
root, err := fs.Sub(embeddedPublic, "public")
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
|
||
|
fs := http.FileServer(http.FS(root))
|
||
|
|
||
|
http.Handle("/", fs)
|
||
|
|
||
|
log.Printf("app built from revision '%s'\n", version)
|
||
|
log.Print("Listening on :1314...")
|
||
|
|
||
|
err = http.ListenAndServe(":1314", nil)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|