From 013bfc7ebc608e0c3fbb568fa323649595442a3c Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 7 Jun 2020 11:02:35 +0300 Subject: [PATCH] vweb: add vweb.run_app(app,port); fix compilation of vweb_assets/main.v --- examples/vweb/vweb_assets/main.v | 4 ++-- vlib/vweb/vweb.v | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/vweb/vweb_assets/main.v b/examples/vweb/vweb_assets/main.v index 70aad5581a..eae1d07f3e 100644 --- a/examples/vweb/vweb_assets/main.v +++ b/examples/vweb/vweb_assets/main.v @@ -8,8 +8,8 @@ const ( port = 8081 ) -pub struct App { -mut: +struct App { +pub mut: vweb vweb.Context } diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 328ec5b789..81571879ca 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -128,15 +128,14 @@ pub fn (ctx &Context) get_header(key string) string { //} -pub fn foo() { - -} - pub fn run(port int) { -//pub fn run(app mut T, port int) { + mut app := T{} + run_app(mut app, port) +} + +pub fn run_app(mut app T, port int) { println('Running a Vweb app on http://localhost:$port ...') l := net.listen(port) or { panic('failed to listen') } - mut app := T{} app.vweb = Context{} app.init() //app.reset()