From de73ef665c840fb786b28d03ca80f57820e85d50 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 11 Mar 2021 16:20:58 +0300 Subject: [PATCH] tutorials: a temporary autofree fix in the blog example --- .../code/blog/blog.v | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tutorials/building_a_simple_web_blog_with_vweb/code/blog/blog.v b/tutorials/building_a_simple_web_blog_with_vweb/code/blog/blog.v index c17a34de16..9f83d35768 100644 --- a/tutorials/building_a_simple_web_blog_with_vweb/code/blog/blog.v +++ b/tutorials/building_a_simple_web_blog_with_vweb/code/blog/blog.v @@ -33,8 +33,8 @@ pub fn (app &App) index() vweb.Result { pub fn (mut app App) init_once() { app.db = sqlite.connect('blog.db') or { panic(err) } - app.db.exec('create table if not exists article (' + 'id integer primary key, ' + "title text default ''," + - "text text default ''" + ');') + app.db.exec('create table if not exists article (' + 'id integer primary key, ' + + "title text default ''," + "text text default ''" + ');') } pub fn (mut app App) init() { @@ -44,8 +44,7 @@ pub fn (mut app App) new() vweb.Result { return $vweb.html() } -[post] -['/new_article'] +['/new_article'; post] pub fn (mut app App) new_article() vweb.Result { title := app.form['title'] text := app.form['text'] @@ -66,7 +65,8 @@ pub fn (mut app App) new_article() vweb.Result { pub fn (mut app App) articles() { articles := app.find_all_articles() - app.json(json.encode(articles)) + x := json.encode(articles) + app.json(x) } fn (mut app App) time() {