examples: allow for ./v run examples/xvweb/todo, without needing to first change the current folder to examples/xvweb/

This commit is contained in:
Delyan Angelov 2024-01-25 21:46:12 +02:00
parent e1655fff1f
commit a17b54527a
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -6,6 +6,7 @@ module main
import x.vweb import x.vweb
import db.sqlite import db.sqlite
import os
import time import time
struct Todo { struct Todo {
@ -125,6 +126,7 @@ pub fn (app &App) delete_todo(mut ctx Context, id int) vweb.Result {
} }
fn main() { fn main() {
os.chdir(os.dir(@FILE))!
// create a new App instance with a connection to the datbase // create a new App instance with a connection to the datbase
mut app := &App{ mut app := &App{
db: sqlite.connect('todo.db')! db: sqlite.connect('todo.db')!