static files

This commit is contained in:
微凉
2021-10-30 19:26:23 +08:00
parent 2780efaea8
commit eb358e6ede
7 changed files with 29 additions and 9 deletions

View File

@ -27,11 +27,14 @@ func Init() {
func main() {
Init()
app := fiber.New()
server.InitApiRouter(app)
app.Use("/",filesystem.New(filesystem.Config{
Root: http.FS(public.Public),
//NotFoundFile: "index.html",
NotFoundFile: "index.html",
}))
server.InitApiRouter(app)
log.Info("starting server")
_ = app.Listen(fmt.Sprintf(":%d", conf.Conf.Port))
err := app.Listen(fmt.Sprintf(":%d", conf.Conf.Port))
if err != nil {
log.Errorf("failed to start: %s", err.Error())
}
}