This commit is contained in:
2025-08-21 09:45:41 +02:00
parent b109299210
commit 601e5db76a
2 changed files with 10 additions and 7 deletions

View File

@@ -2,7 +2,6 @@ module ui
import veb
import os
import net.http
// Public Context type for veb
@@ -20,7 +19,7 @@ pub:
// Factory args
@[params]
pub struct FactoryArgs {
pub struct WebArgs {
pub mut:
name string = 'default'
host string = 'localhost'
@@ -34,15 +33,19 @@ pub mut:
pub struct App {
veb.StaticHandler
pub mut:
title string
title string = "default"
menu []MenuItem
port int
port int = 7711
}
// Start the webserver (blocking)
pub fn start(args FactoryArgs) ! {
mut app := new(args)!
pub fn start(args WebArgs) ! {
mut app := App{
title: args.title,
menu: args.menu,
port: args.port
}
veb.run[App, Context](mut app, app.port)
}