initialize backend project

Signed-off-by: Tobias Erbshäußer <tobias@tesoft.dev>
This commit is contained in:
2026-05-24 09:31:18 +02:00
parent 126fde7151
commit 7c1e2fb228
6 changed files with 64 additions and 1 deletions
+32
View File
@@ -0,0 +1,32 @@
package main
import (
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
staticFolder := os.Getenv("STATIC_FOLDER")
if staticFolder == "" {
staticFolder = "static"
}
fsHandler := http.FileServer(http.Dir(staticFolder))
apiHandler := NewApiHandler()
mux := http.NewServeMux()
mux.Handle("/", fsHandler)
mux.Handle("/api/", apiHandler)
log.Println("Listening on port", port)
err := http.ListenAndServe(":"+port, mux)
if err != nil {
log.Fatalln(err.Error())
}
}