Skip to content

Commit b14f779

Browse files
committed
vweb: add a placeholder for checking route validity at startup
1 parent d34c5b7 commit b14f779

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vlib/vweb/vweb.v

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ pub fn run_app<T>(mut app T, port int) {
199199
l := net.listen(port) or { panic('failed to listen') }
200200
app.vweb = Context{}
201201
app.init_once()
202+
$for method in T.methods {
203+
$if method.return_type is Result {
204+
// check routes for validity
205+
}
206+
}
202207
//app.reset()
203208
for {
204209
conn := l.accept() or { panic('accept() failed') }
@@ -375,7 +380,7 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
375380
mut vars := []string{cap: route_words_a.len}
376381
mut action := ''
377382
$for method in T.methods {
378-
$if method.return_type is Result {
383+
$if method.return_type is Result {
379384
attrs := method.attrs
380385
route_words_a = [][]string{}
381386
if attrs.len == 0 {

0 commit comments

Comments
 (0)