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

vweb: remove init_server() from all examples, tutorials, and tests

This commit is contained in:
Alexander Medvednikov
2021-08-03 16:03:16 +03:00
parent f879b3e221
commit 80976e640c
7 changed files with 30 additions and 55 deletions

View File

@@ -7,7 +7,7 @@ import sqlite
struct App {
vweb.Context
pub mut:
db sqlite.DB [server_var]
db sqlite.DB
user_id string
}
@@ -25,7 +25,9 @@ fn test_a_vweb_application_compiles() {
vweb.run(&App{}, 18081)
}
pub fn (mut app App) init_server() {
/*
/TODO
pub fn (mut app App) init_server_old() {
app.db = sqlite.connect('blog.db') or { panic(err) }
app.db.create_table('article', [
'id integer primary key',
@@ -33,6 +35,7 @@ pub fn (mut app App) init_server() {
"text text default ''",
])
}
*/
pub fn (mut app App) before_request() {
app.user_id = app.get_cookie('id') or { '0' }