vweb: fix index (#5682)
parent
d0e321c8a3
commit
3cd9e2cab7
|
@ -29,7 +29,7 @@ pub fn (mut app App) init_once() {
|
||||||
|
|
||||||
pub fn (mut app App) init() {}
|
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.
|
// We can dynamically specify which assets are to be used in template.
|
||||||
mut am := assets.new_manager()
|
mut am := assets.new_manager()
|
||||||
am.add_css('assets/index.css')
|
am.add_css('assets/index.css')
|
||||||
|
|
|
@ -346,6 +346,13 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
|
||||||
// since such methods have a priority.
|
// since such methods have a priority.
|
||||||
// For example URL `/register` matches route `/:user`, but `fn register()`
|
// For example URL `/register` matches route `/:user`, but `fn register()`
|
||||||
// should be called first.
|
// should be called first.
|
||||||
|
|
||||||
|
if url_words.len == 0 {
|
||||||
|
app.index()
|
||||||
|
conn.close() or {}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
println('no attrs for ${url_words[0]}')
|
println('no attrs for ${url_words[0]}')
|
||||||
if url_words[0] == method {
|
if url_words[0] == method {
|
||||||
println('easy match $method')
|
println('easy match $method')
|
||||||
|
|
Loading…
Reference in New Issue