Description of the problem
According to V's doc, using vweb, in order to serve static files one just has to add the following line to a server:
app.mount_static_folder_at(os.resource_abs_path('dist'), '/content')
So, for instance: the following server is supposed to serve the content of the local directory ./dist at the address: http://localhost:8080/content
The complete code being :
import vweb
import os
struct App {
vweb.Context
}
fn main() {
mut app := &App{}
println(os.resource_abs_path('dist'))
app.mount_static_folder_at(os.resource_abs_path('dist'), '/content')
vweb.run(app, 8080)
}
["/"]
fn (mut app App) root() vweb.Result {
return app.text('Hello from root')
}
Expected Behavior
The server is supposed to serve the content of the local directory ./dist at the address: http://localhost:8080/content
Current Behavior
404 Not Found
Reproduction Steps
println(os.resource_abs_path('dist')) yields
C:\Users\serge\Documents\vue-tests\vue-tests-nomodules\v2\dist
Which is correct, plus:
ls lists
---- ------------- ------ ----
d----- 2/11/2023 6:45 PM dist
d----- 2/11/2023 6:45 PM src
-a---- 2/11/2023 5:53 PM 139 .editorconfig
-a---- 2/11/2023 5:53 PM 148 .gitattributes
-a---- 2/11/2023 5:53 PM 237 .gitignore
-a---- 2/11/2023 6:06 PM 85 v.mod
-a---- 2/12/2023 12:56 PM 2037248 v2.exe
PS C:\Users\serge\Documents\vue-tests\vue-tests-nomodules\v2> ls .\dist\
Directory: C:\Users\serge\Documents\vue-tests\vue-tests-nomodules\v2\dist
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/11/2023 6:32 PM 295 app.html
-a---- 2/11/2023 6:42 PM 295 index.html
Possible Solution
No response
Additional Information/Context

No response
V version
V 0.3.3 90591eb
Environment details (OS name and version, etc.)
Windows 11
A bit too late, but I had a similar issue lately.
Apparently, it does matter how you start the
vwebserver.and in my temaplte
You could also use path in href like
In order to run this properly just
v run .from your <my_project> and not from<project_dir>/src