examples: fix static vweb assets example (#11008)

pull/11017/head
shadow 2021-08-01 14:46:30 -04:00 committed by GitHub
parent dbf5c976a3
commit eca7af107a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 10 deletions

View File

@ -1,7 +1,7 @@
<html>
<header>
<title>@title</title>
@css 'examples/vweb/vweb_assets/assets/index.css'
@css 'index.css'
</header>
<body>
<h1>@title</h1>

View File

@ -13,17 +13,11 @@ struct App {
}
fn main() {
vweb.run(&App{}, port)
}
pub fn (mut app App) init_server() {
// Arbitary mime type.
mut app := &App{}
app.serve_static('/favicon.ico', 'favicon.ico')
// Automatically make available known static mime types found in given directory.
// app.handle_static('assets')
// This would make available all known static mime types from current
// directory and below.
app.handle_static('.', false)
app.handle_static('assets', true)
vweb.run(app, port)
}
pub fn (mut app App) index() vweb.Result {