From eca7af107a2573b728a05a7ace4525ff2ac6fd2f Mon Sep 17 00:00:00 2001
From: shadow <49539636+shadowninja55@users.noreply.github.com>
Date: Sun, 1 Aug 2021 14:46:30 -0400
Subject: [PATCH] examples: fix static vweb assets example (#11008)
---
examples/vweb/vweb_assets/index.html | 2 +-
examples/vweb/vweb_assets/vweb_assets.v | 12 +++---------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/examples/vweb/vweb_assets/index.html b/examples/vweb/vweb_assets/index.html
index f687e58438..6635329ad0 100644
--- a/examples/vweb/vweb_assets/index.html
+++ b/examples/vweb/vweb_assets/index.html
@@ -1,7 +1,7 @@
@title
- @css 'examples/vweb/vweb_assets/assets/index.css'
+ @css 'index.css'
@title
diff --git a/examples/vweb/vweb_assets/vweb_assets.v b/examples/vweb/vweb_assets/vweb_assets.v
index 05d5da0ae4..058f45922b 100644
--- a/examples/vweb/vweb_assets/vweb_assets.v
+++ b/examples/vweb/vweb_assets/vweb_assets.v
@@ -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 {