Skip to content

Commit

Permalink
🐛 route conflict between web and pprof.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiertop committed Mar 31, 2024
1 parent ab97f11 commit 94db464
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func initRouter(h *server.Hertz) {
})

h.GET("/", adaptor.NewHertzHTTPHandler(http.FileServer(http.FS(web.IndexHtml))))
h.GET("/*filepath", adaptor.NewHertzHTTPHandler(http.FileServerFS(web.Dist)))
h.GET("/static/*filepath", adaptor.NewHertzHTTPHandler(http.FileServerFS(web.Dist)))
h.POST("/ping", func(_ context.Context, c *app.RequestContext) {
var m map[string]any
if err := c.BindJSON(&m); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion web/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import "embed"
//go:embed index.html
var IndexHtml embed.FS

//go:embed assets
//go:embed static/assets/*
var Dist embed.FS
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</head>
<body>
<div class="main">
<img id="go-img" src="assets/go-grow.png" alt="">
<img id="go-img" src="static/assets/go-grow.png" alt="">
</div>
</body>
<style>
Expand Down
File renamed without changes

0 comments on commit 94db464

Please sign in to comment.