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:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user