vweb: add vweb.run_app(app,port); fix compilation of vweb_assets/main.v

pull/5252/head
Delyan Angelov 2020-06-07 11:02:35 +03:00
parent caa25a3150
commit 013bfc7ebc
2 changed files with 7 additions and 8 deletions

View File

@ -8,8 +8,8 @@ const (
port = 8081
)
pub struct App {
mut:
struct App {
pub mut:
vweb vweb.Context
}

View File

@ -128,15 +128,14 @@ pub fn (ctx &Context) get_header(key string) string {
//}
pub fn foo<T>() {
pub fn run<T>(port int) {
mut app := T{}
run_app<T>(mut app, port)
}
pub fn run<T>(port int) {
//pub fn run<T>(app mut T, port int) {
pub fn run_app<T>(mut app T, port int) {
println('Running a Vweb app on http://localhost:$port ...')
l := net.listen(port) or { panic('failed to listen') }
mut app := T{}
app.vweb = Context{}
app.init()
//app.reset()