vweb: add vweb.run_app(app,port); fix compilation of vweb_assets/main.v
parent
caa25a3150
commit
013bfc7ebc
|
@ -8,8 +8,8 @@ const (
|
||||||
port = 8081
|
port = 8081
|
||||||
)
|
)
|
||||||
|
|
||||||
pub struct App {
|
struct App {
|
||||||
mut:
|
pub mut:
|
||||||
vweb vweb.Context
|
vweb vweb.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,15 +128,14 @@ pub fn (ctx &Context) get_header(key string) string {
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pub fn foo<T>() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn run<T>(port int) {
|
pub fn run<T>(port int) {
|
||||||
//pub fn run<T>(app mut T, port int) {
|
mut app := T{}
|
||||||
|
run_app<T>(mut app, port)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn run_app<T>(mut app T, port int) {
|
||||||
println('Running a Vweb app on http://localhost:$port ...')
|
println('Running a Vweb app on http://localhost:$port ...')
|
||||||
l := net.listen(port) or { panic('failed to listen') }
|
l := net.listen(port) or { panic('failed to listen') }
|
||||||
mut app := T{}
|
|
||||||
app.vweb = Context{}
|
app.vweb = Context{}
|
||||||
app.init()
|
app.init()
|
||||||
//app.reset()
|
//app.reset()
|
||||||
|
|
Loading…
Reference in New Issue