We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b6e5d3e commit 9758d91Copy full SHA for 9758d91
api/base.go
@@ -9,6 +9,7 @@ import (
9
"polkovnik/domain"
10
"polkovnik/job"
11
"polkovnik/repository"
12
+ "strings"
13
"time"
14
)
15
@@ -107,7 +108,14 @@ type SpaHandler struct {
107
108
}
109
110
func (h SpaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- _, err := h.Files.Open(h.StaticPath + r.URL.Path)
111
+ path := h.StaticPath + r.URL.Path
112
+
113
+ //Если запрашивается папка, то нужно смотреть на индексный файл
114
+ if strings.HasSuffix(path, "/") {
115
+ path = path + h.IndexPath
116
+ }
117
118
+ _, err := h.Files.Open(path)
119
120
//Если запрашиваемого файла нет, отдаем главную страницу. Далее отработает роутинг в JavaScript
121
if os.IsNotExist(err) {
0 commit comments