1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tutorials: blog fixes (#5652)

This commit is contained in:
Louis Schmieder 2020-07-04 11:38:47 +02:00 committed by GitHub
parent 765ffa37eb
commit 56ad6cef54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -25,14 +25,16 @@ fn (app &App) index_html() {
$vweb.html()
}
*/
fn (app &App) index() vweb.Result {
articles := app.find_all_articles()
return $vweb.html()
}
pub fn (mut app App) init_once() {
db := sqlite.connect(':memory:') or { panic(err) }
db := sqlite.connect(':memory:') or {
panic(err)
}
db.exec('create table `Article` (id integer primary key, title text default "", text text default "")')
app.db = db
}