1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples: make the vweb_assets.v example more robust (always change work folder to the folder of the executable). Document the vweb.Context.handle_static behaviour.

This commit is contained in:
Delyan Angelov
2022-03-21 19:05:18 +02:00
parent f2e0ab5912
commit 3bae489e35
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
module main
import os
import vweb
// import vweb.assets
import time
@ -16,6 +17,7 @@ fn main() {
mut app := &App{}
app.serve_static('/favicon.ico', 'favicon.ico')
// Automatically make available known static mime types found in given directory.
os.chdir(os.dir(os.executable())) ?
app.handle_static('assets', true)
vweb.run(app, port)
}