Skip to content

Commit

Permalink
serve static files with FileServer
Browse files Browse the repository at this point in the history
  • Loading branch information
kubegu committed Jun 17, 2024
1 parent fd876e7 commit 60e4661
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ var htmlTemplates embed.FS
func InitMux() *http.ServeMux {
mux := http.NewServeMux()

mux.HandleFunc("/games/", gamesIndexPageHandler)
mux.HandleFunc("/movies/", moviePageHandler)
mux.Handle("/", http.FileServer(http.Dir("web/static")))
mux.HandleFunc("/games-index/", gameIndexHandler)
mux.HandleFunc("/movies-search/", movieSearchHandler)
return mux
Expand All @@ -31,16 +30,6 @@ type MediaByBranch struct {
Media []domain.Media
}

func gamesIndexPageHandler(respWriter http.ResponseWriter, request *http.Request) {
templ := template.Must(template.ParseFS(htmlTemplates, "templates/games-index.html"))
templ.Execute(respWriter, nil)
}

func moviePageHandler(respWriter http.ResponseWriter, request *http.Request) {
template := template.Must(template.ParseFS(htmlTemplates, "templates/movies.html"))
template.Execute(respWriter, nil)
}

func gameSearchHandler(respWriter http.ResponseWriter, request *http.Request) {

}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 60e4661

Please sign in to comment.