Skip to content

Commit

Permalink
fixing to work with index dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
radiosilence committed Jan 23, 2024
1 parent 24b22a8 commit 7472e8b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ func main() {
if info.IsDir() {
return nil
}
e.GET(strings.Replace(path, "public", "", 1), func(c echo.Context) error {
return c.File(path)
})
urlPath := strings.Replace(path, "public", "", 1)
if info.Name() == "index.html" {
indexUrlPath := strings.Replace(urlPath, "/index.html", "/", 1)
e.File(indexUrlPath, path)
}
e.Logger.Info("added route for file", urlPath, path)
fmt.Println("adding route", urlPath, path)
e.File(urlPath, path)
return nil
})

Expand Down

0 comments on commit 7472e8b

Please sign in to comment.