mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tutorials: blog fixes (#5652)
This commit is contained in:
parent
765ffa37eb
commit
56ad6cef54
2 changed files with 8 additions and 6 deletions
|
@ -25,14 +25,16 @@ fn (app &App) index_html() {
|
||||||
$vweb.html()
|
$vweb.html()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fn (app &App) index() vweb.Result {
|
fn (app &App) index() vweb.Result {
|
||||||
articles := app.find_all_articles()
|
articles := app.find_all_articles()
|
||||||
return $vweb.html()
|
return $vweb.html()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut app App) init_once() {
|
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
|
app.db = db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue