tutorials: blog fixes (#5652)
parent
765ffa37eb
commit
56ad6cef54
|
@ -25,21 +25,23 @@ 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
|
||||
}
|
||||
|
||||
pub fn (mut app App) init() {
|
||||
}
|
||||
|
||||
pub fn (mut app App) new() vweb.Result{
|
||||
pub fn (mut app App) new() vweb.Result {
|
||||
return $vweb.html()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue