What am I doing wrong, if this code works only when I specify the path to index.html in the URL?
That is, it does not work:
http: //Localhost: 3001 /API
So works:
http: //LocalHost: 3001 /API /index.html
-Documentation is displayed.
Documentation is a Doc catalog with subcatalogues CSS, IMG, VENDOR, etc. + index.html, in which the relative path is registered to these subcatalogues.
So:= fiber.static {
Index: "index.html",
Compress: True,
Maxage: 1,
CacheDuration: 10 * Time.second,
}
Directory:= filepath.join (t.exe.dir, "../doc")
App.Static ("/API", Directory, SO)
At the same time, a similar route for the root
SO= fiber.static {
Index: "index.html",
Compress: True,
Maxage: 1,
CacheDuration: 10 * Time.second,
}
Directory= FilePath.join (t.exe.dir, "../assets")
App.Static ("/", Directory, SO)
works fine.
index.html is specified in the WEB framework itself. And browsers have nothing to do with it. Browsers receive a server response and they do not care what and where is spelled out. They just render the answer.
Garry Galler2021-04-08 12:01:14-
Answer # 1
Try
App.Static ("/API /", Directory, SO)
Welcome to this Club in Russian! Please leave a little more deployed answers. Try to tell about all the nuances that may arise when solving the problem according to your scenario. Present your suggestions. It is possible and a brief answer, but the more and more clear it will be outlined, the better. You can add the answer by clicking Edit
aleksandr barakin2021-04-07 17:43:18
Browsers seem to refer to index.html when they refer to the root. not?
Senior Pomidor2021-04-08 12:01:14