Skip to content

Commit eca7af1

Browse files
examples: fix static vweb assets example (#11008)
1 parent dbf5c97 commit eca7af1

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

examples/vweb/vweb_assets/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html>
22
<header>
33
<title>@title</title>
4-
@css 'examples/vweb/vweb_assets/assets/index.css'
4+
@css 'index.css'
55
</header>
66
<body>
77
<h1>@title</h1>

examples/vweb/vweb_assets/vweb_assets.v

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,11 @@ struct App {
1313
}
1414

1515
fn main() {
16-
vweb.run(&App{}, port)
17-
}
18-
19-
pub fn (mut app App) init_server() {
20-
// Arbitary mime type.
16+
mut app := &App{}
2117
app.serve_static('/favicon.ico', 'favicon.ico')
2218
// Automatically make available known static mime types found in given directory.
23-
// app.handle_static('assets')
24-
// This would make available all known static mime types from current
25-
// directory and below.
26-
app.handle_static('.', false)
19+
app.handle_static('assets', true)
20+
vweb.run(app, port)
2721
}
2822

2923
pub fn (mut app App) index() vweb.Result {

0 commit comments

Comments
 (0)