diff --git a/tools/gen_vc.v b/tools/gen_vc.v index 5e4ffbcdb3..3f054b2219 100644 --- a/tools/gen_vc.v +++ b/tools/gen_vc.v @@ -128,8 +128,7 @@ fn main() { // webhook server mode if flag_options.serve { - app := WebhookServer{ gen_vc: new_gen_vc(flag_options) } - vweb.run(mut app, flag_options.port) + vweb.run(flag_options.port) } // cmd mode else { @@ -154,10 +153,12 @@ fn new_gen_vc(flag_options FlagOptions) &GenVC { // WebhookServer init pub fn (ws mut WebhookServer) init() { + mut fp := flag.new_flag_parser(os.args.clone()) flag_options := parse_flags(mut fp) ws.gen_vc = new_gen_vc(flag_options) ws.gen_vc.init() + //ws.gen_vc = new_gen_vc(flag_options) } // gen webhook @@ -171,6 +172,10 @@ pub fn (ws mut WebhookServer) genhook() { ws.vweb.json('{status: "ok"}') } +pub fn (ws &WebhookServer) reset() { +} + + // parse flags to FlagOptions struct fn parse_flags(fp mut flag.FlagParser) FlagOptions { return FlagOptions{ diff --git a/tutorials/building-a-simple-web-blog-with-vweb.md b/tutorials/building-a-simple-web-blog-with-vweb.md index 08abec4bcf..8ae6621d77 100644 --- a/tutorials/building-a-simple-web-blog-with-vweb.md +++ b/tutorials/building-a-simple-web-blog-with-vweb.md @@ -63,8 +63,7 @@ mut: } fn main() { - app := App{} - vweb.run(mut app, 8080) + vweb.run(8080) } fn (app mut App) index() { diff --git a/tutorials/code/blog/blog.v b/tutorials/code/blog/blog.v index d6c70d63fd..df99c2138c 100644 --- a/tutorials/code/blog/blog.v +++ b/tutorials/code/blog/blog.v @@ -14,8 +14,7 @@ mut: } fn main() { - app := App{} - vweb.run(mut app, 8080) + vweb.run(8080) } fn (app mut App) index_text() {