vweb: fix index (#5682)

pull/5693/head
Louis Schmieder 2020-07-05 22:05:58 +02:00 committed by GitHub
parent d0e321c8a3
commit 3cd9e2cab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -29,7 +29,7 @@ pub fn (mut app App) init_once() {
pub fn (mut app App) init() {}
fn (mut app App) index() {
pub fn (mut app App) index() {
// We can dynamically specify which assets are to be used in template.
mut am := assets.new_manager()
am.add_css('assets/index.css')

View File

@ -346,6 +346,13 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
// since such methods have a priority.
// For example URL `/register` matches route `/:user`, but `fn register()`
// should be called first.
if url_words.len == 0 {
app.index()
conn.close() or {}
return
}
println('no attrs for ${url_words[0]}')
if url_words[0] == method {
println('easy match $method')