Clean up error handling, migrate to log/slog, add todo for flash message system in post controller

This commit is contained in:
Maximilian
2023-09-03 15:45:12 -05:00
parent ee4c9f9199
commit ed712a5344
10 changed files with 51 additions and 68 deletions

View File

@ -4,7 +4,7 @@ import (
"GoWeb/app"
"GoWeb/controllers"
"io/fs"
"log"
"log/slog"
"net/http"
)
@ -18,12 +18,12 @@ func Get(app *app.App) {
// Serve static files
staticFS, err := fs.Sub(app.Res, "static")
if err != nil {
log.Println(err)
slog.Error(err.Error())
return
}
staticHandler := http.FileServer(http.FS(staticFS))
http.Handle("/static/", http.StripPrefix("/static/", staticHandler))
log.Println("Serving static files from embedded file system /static")
slog.Info("Serving static files from embedded file system /static")
// Pages
http.HandleFunc("/", getController.ShowHome)