mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: migrate all tests and examples to the new syntax
This commit is contained in:
@@ -9,8 +9,7 @@ const (
|
||||
)
|
||||
|
||||
struct App {
|
||||
pub mut:
|
||||
vweb vweb.Context
|
||||
vweb.Context
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -19,9 +18,9 @@ fn main() {
|
||||
|
||||
pub fn (mut app App) init_once() {
|
||||
// Arbitary mime type.
|
||||
app.vweb.serve_static('/favicon.ico', 'favicon.ico', 'img/x-icon')
|
||||
app.serve_static('/favicon.ico', 'favicon.ico', 'img/x-icon')
|
||||
// Automatically make available known static mime types found in given directory.
|
||||
app.vweb.handle_static('assets')
|
||||
app.handle_static('assets')
|
||||
// This would make available all known static mime types from current
|
||||
// directory and below.
|
||||
// app.vweb.handle_static('.')
|
||||
@@ -41,10 +40,10 @@ pub fn (mut app App) index() {
|
||||
$vweb.html()
|
||||
}
|
||||
|
||||
fn (mut app App) text() {
|
||||
app.vweb.text('Hello, world from vweb!')
|
||||
fn (mut app App) text() vweb.Result {
|
||||
return app.text('Hello, world from vweb!')
|
||||
}
|
||||
|
||||
fn (mut app App) time() {
|
||||
app.vweb.text(time.now().format())
|
||||
fn (mut app App) time() vweb.Result {
|
||||
return app.text(time.now().format())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user