examples: fix static vweb assets example (#11008)
							parent
							
								
									dbf5c976a3
								
							
						
					
					
						commit
						eca7af107a
					
				| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
<html>
 | 
					<html>
 | 
				
			||||||
<header>
 | 
					<header>
 | 
				
			||||||
	<title>@title</title>
 | 
						<title>@title</title>
 | 
				
			||||||
	@css 'examples/vweb/vweb_assets/assets/index.css'
 | 
						@css 'index.css'
 | 
				
			||||||
</header>
 | 
					</header>
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
	<h1>@title</h1>
 | 
						<h1>@title</h1>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,17 +13,11 @@ struct App {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
	vweb.run(&App{}, port)
 | 
						mut app := &App{}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pub fn (mut app App) init_server() {
 | 
					 | 
				
			||||||
	// Arbitary mime type.
 | 
					 | 
				
			||||||
	app.serve_static('/favicon.ico', 'favicon.ico')
 | 
						app.serve_static('/favicon.ico', 'favicon.ico')
 | 
				
			||||||
	// Automatically make available known static mime types found in given directory.
 | 
						// Automatically make available known static mime types found in given directory.
 | 
				
			||||||
	// app.handle_static('assets')
 | 
						app.handle_static('assets', true)
 | 
				
			||||||
	// This would make available all known static mime types from current
 | 
						vweb.run(app, port)
 | 
				
			||||||
	// directory and below.
 | 
					 | 
				
			||||||
	app.handle_static('.', false)
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn (mut app App) index() vweb.Result {
 | 
					pub fn (mut app App) index() vweb.Result {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue