From aaf3d3315d378c151834ad0ce86c6c7b1afd9cf9 Mon Sep 17 00:00:00 2001 From: jpeg729 Date: Sun, 1 Jun 2025 16:07:44 +0200 Subject: [PATCH] tutorials: fix compilation errors in `Building a simple web blog with Veb` (#24631) --- .../building_a_simple_web_blog_with_veb/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tutorials/building_a_simple_web_blog_with_veb/README.md b/tutorials/building_a_simple_web_blog_with_veb/README.md index df85a0edc2..1a2e072894 100644 --- a/tutorials/building_a_simple_web_blog_with_veb/README.md +++ b/tutorials/building_a_simple_web_blog_with_veb/README.md @@ -102,8 +102,8 @@ no routing rules either: import veb import time -fn (mut app App) time() veb.Result { - return app.text(time.now().format()) +fn (app &App) time(mut ctx Context) veb.Result { + return ctx.text(time.now().format()) } ``` @@ -137,7 +137,7 @@ and update our `index()` action so that it returns the HTML view we just created ```v ignore // blog.v -pub fn (mut app App) index() veb.Result { +pub fn (app &App) index(mut ctx Context) veb.Result { message := 'Hello, world from Vweb!' return $veb.html() } @@ -375,7 +375,7 @@ Next we need to add the HTML endpoint to our code like we did with `index.html`: ```v ignore @['/new'] -pub fn (mut app App) new() veb.Result { +pub fn (app &App) new() veb.Result { return $veb.html() } ``` @@ -392,9 +392,9 @@ in V is very simple: import veb @['/articles'; get] -pub fn (mut app App) articles() veb.Result { +pub fn (app &App) articles(mut ctx Context) veb.Result { articles := app.find_all_articles() - return app.json(articles) + return ctx.json(articles) } ```