feat: update issues
This commit is contained in:
@@ -2,6 +2,7 @@ package http
|
||||
|
||||
import (
|
||||
"context"
|
||||
"mime"
|
||||
"path/filepath"
|
||||
|
||||
appHttp "quyun/app/http"
|
||||
@@ -125,10 +126,17 @@ func Serve(cmd *cobra.Command, args []string) error {
|
||||
if f == "/" || f == "" {
|
||||
f = "index.html"
|
||||
}
|
||||
ext := filepath.Ext(f)
|
||||
mime := mime.TypeByExtension(ext)
|
||||
log.Infof("mime type: %s %s", ext, mime)
|
||||
ctx.Set(fiber.HeaderContentType, mime)
|
||||
|
||||
file, err := fabfile.Find(filepath.Join("frontend/wechat/dist", f))
|
||||
if err != nil {
|
||||
return ctx.SendStatus(fiber.StatusNotFound)
|
||||
file, err = fabfile.Find(filepath.Join("frontend/wechat/dist", "index.html"))
|
||||
if err != nil {
|
||||
return ctx.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
}
|
||||
return ctx.SendFile(file)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user