vweb: add a placeholder for checking route validity at startup
parent
d34c5b767b
commit
b14f779853
|
@ -199,6 +199,11 @@ pub fn run_app<T>(mut app T, port int) {
|
||||||
l := net.listen(port) or { panic('failed to listen') }
|
l := net.listen(port) or { panic('failed to listen') }
|
||||||
app.vweb = Context{}
|
app.vweb = Context{}
|
||||||
app.init_once()
|
app.init_once()
|
||||||
|
$for method in T.methods {
|
||||||
|
$if method.return_type is Result {
|
||||||
|
// check routes for validity
|
||||||
|
}
|
||||||
|
}
|
||||||
//app.reset()
|
//app.reset()
|
||||||
for {
|
for {
|
||||||
conn := l.accept() or { panic('accept() failed') }
|
conn := l.accept() or { panic('accept() failed') }
|
||||||
|
@ -375,7 +380,7 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
|
||||||
mut vars := []string{cap: route_words_a.len}
|
mut vars := []string{cap: route_words_a.len}
|
||||||
mut action := ''
|
mut action := ''
|
||||||
$for method in T.methods {
|
$for method in T.methods {
|
||||||
$if method.return_type is Result {
|
$if method.return_type is Result {
|
||||||
attrs := method.attrs
|
attrs := method.attrs
|
||||||
route_words_a = [][]string{}
|
route_words_a = [][]string{}
|
||||||
if attrs.len == 0 {
|
if attrs.len == 0 {
|
||||||
|
|
Loading…
Reference in New Issue