mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: run app.init() once
This commit is contained in:
parent
8ecd62e56f
commit
81da1f1ab2
@ -88,6 +88,8 @@ $html
|
||||
pub fn run<T>(port int) {
|
||||
println('Running vweb app on http://localhost:$port ...')
|
||||
l := net.listen(port) or { panic('failed to listen') return }
|
||||
mut app := T{}
|
||||
app.init()
|
||||
for {
|
||||
conn := l.accept() or {
|
||||
panic('accept() failed')
|
||||
@ -138,16 +140,15 @@ pub fn run<T>(port int) {
|
||||
method: vals[0]
|
||||
url: vals[1]
|
||||
}
|
||||
mut app := T{
|
||||
vweb: Context{
|
||||
req: req
|
||||
conn: conn
|
||||
post_form: map[string]string{}
|
||||
static_files: map[string]string{}
|
||||
static_mime_types: map[string]string{}
|
||||
}
|
||||
//mut app := T{
|
||||
app.vweb = Context{
|
||||
req: req
|
||||
conn: conn
|
||||
post_form: map[string]string{}
|
||||
static_files: map[string]string{}
|
||||
static_mime_types: map[string]string{}
|
||||
}
|
||||
app.init()
|
||||
//}
|
||||
if req.method == 'POST' {
|
||||
app.vweb.parse_form(s)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user