1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: route to index dynamically (#7782)

This commit is contained in:
Daniel Däschle
2021-01-05 01:30:27 +01:00
committed by GitHub
parent a7a8e659f6
commit 9f74be4cf6
3 changed files with 37 additions and 28 deletions

View File

@@ -60,7 +60,7 @@ fn assert_common_headers(received string) {
}
fn test_a_simple_tcp_client_can_connect_to_the_vweb_server() {
received := simple_tcp_client({}) or {
received := simple_tcp_client(path: '/') or {
assert err == ''
return
}

View File

@@ -44,13 +44,12 @@ pub fn (mut app App) init_once() {
eprintln('>> webserver: started on http://127.0.0.1:$app.port/ , with maximum runtime of $app.timeout milliseconds.')
}
pub fn (mut app App) index() {
app.text('Welcome to VWeb')
pub fn (mut app App) index() vweb.Result {
return app.text('Welcome to VWeb')
}
pub fn (mut app App) simple() vweb.Result {
app.text('A simple result')
return vweb.Result{}
return app.text('A simple result')
}
pub fn (mut app App) html_page() vweb.Result {