www-jmbit-de/server.go
Johannes Bülow bff4de6937
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reverted change in server.go that moved the listen port off of port 80
2024-11-27 10:18:07 +01:00

31 lines
490 B
Go

package main
import (
"embed"
"io/fs"
"log"
"net/http"
)
//go:embed public/*
var publicFS embed.FS
func main() {
// Register a custom handler
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fsroot, err := fs.Sub(publicFS, "public")
if err != nil {
panic(err)
}
http.FileServer(http.FS(fsroot)).ServeHTTP(w,r)
})
// Start the HTTP server on port 80
err := http.ListenAndServe(":80", nil)
if err != nil {
log.Fatal(err)
}
}