fix issues
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"exporter/database/telegram_resource/public/model"
|
||||
"exporter/database/telegram_resource/public/table"
|
||||
"exporter/frontend/dist"
|
||||
"exporter/frontend"
|
||||
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
@@ -42,21 +42,22 @@ func serveCmd(cmd *cobra.Command, args []string) error {
|
||||
app.Static("/medias", "/share/telegram/outputs")
|
||||
|
||||
app.Use(favicon.New(favicon.Config{
|
||||
Data: dist.Favicon,
|
||||
Data: frontend.Favicon,
|
||||
}))
|
||||
|
||||
app.Use("/assets", filesystem.New(filesystem.Config{
|
||||
Root: http.FS(dist.StaticDist),
|
||||
PathPrefix: "assets",
|
||||
Root: http.FS(frontend.StaticDist),
|
||||
PathPrefix: "dist/assets",
|
||||
}))
|
||||
|
||||
// Initialize default config
|
||||
app.Use(recover.New())
|
||||
|
||||
app.Get("/", func(c *fiber.Ctx) error {
|
||||
indexFunc := func(c *fiber.Ctx) error {
|
||||
c.Context().SetContentType("text/html")
|
||||
return c.SendString(dist.IndexPage)
|
||||
})
|
||||
return c.SendString(frontend.IndexPage)
|
||||
}
|
||||
app.Get("/", indexFunc)
|
||||
|
||||
group := app.Group("/api")
|
||||
|
||||
@@ -202,5 +203,8 @@ func serveCmd(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
})
|
||||
|
||||
// not found route use frontend router
|
||||
// handle 404
|
||||
app.Use(indexFunc)
|
||||
return app.Listen(fmt.Sprintf(":%d", port))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user