Initial MVP: Go + templ Tolino-optimized ebook library scaffold

This commit is contained in:
Arne
2026-08-06 06:52:41 +02:00
parent bf077c0cf6
commit 8d499c28a7
11 changed files with 440 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package main
import (
"log"
"net/http"
"os"
"github.com/arnef/ebooks/internal/library"
"github.com/arnef/ebooks/internal/web"
)
func main() {
booksDir := getenv("BOOKS_DIR", "books")
addr := getenv("ADDR", ":8080")
lib := library.New(booksDir)
h := web.NewHandler(lib)
mux := http.NewServeMux()
h.RegisterRoutes(mux)
log.Printf("ebooks server listening on %s (books dir: %s)", addr, booksDir)
if err := http.ListenAndServe(addr, mux); err != nil {
log.Fatal(err)
}
}
func getenv(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}