diff options
| -rw-r--r-- | cmd/nebbet/main.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/nebbet/main.go b/cmd/nebbet/main.go index 8efd504..210ad67 100644 --- a/cmd/nebbet/main.go +++ b/cmd/nebbet/main.go @@ -14,8 +14,11 @@ package main import ( "flag" "fmt" + "net/http" "os" + "github.com/gin-gonic/gin" + "nebbet.no/internal/admin" "nebbet.no/internal/admin/auth" "nebbet.no/internal/builder" @@ -117,8 +120,10 @@ func cmdServe(args []string) { // Serve dependencies (lib/) engine.Static("/lib", "lib") - // Serve static site from public/ - engine.Static("/", outputDir) + // Serve static site as fallback for unmatched routes + engine.NoRoute(func(c *gin.Context) { + http.FileServer(http.Dir(outputDir)).ServeHTTP(c.Writer, c.Request) + }) addr := ":" + *port fmt.Printf("listening on http://localhost%s\n", addr) |
