mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: check (mut f Foo)
syntax
This commit is contained in:
@@ -17,7 +17,7 @@ fn main() {
|
||||
vweb.run<App>(port)
|
||||
}
|
||||
|
||||
pub fn (app mut App) init() {
|
||||
pub fn (mut app App) init() {
|
||||
// Arbitary mime type.
|
||||
app.vweb.serve_static('/favicon.ico', 'favicon.ico', 'img/x-icon')
|
||||
// Automatically make available known static mime types found in given directory.
|
||||
@@ -27,9 +27,9 @@ pub fn (app mut App) init() {
|
||||
//app.vweb.handle_static('.')
|
||||
}
|
||||
|
||||
pub fn (app mut App) reset() {}
|
||||
pub fn (mut app App) reset() {}
|
||||
|
||||
fn (app mut App) index() {
|
||||
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')
|
||||
@@ -42,10 +42,10 @@ fn (app mut App) index() {
|
||||
$vweb.html()
|
||||
}
|
||||
|
||||
fn (app mut App) text() {
|
||||
fn (mut app App) text() {
|
||||
app.vweb.text('Hello, world from vweb!')
|
||||
}
|
||||
|
||||
fn (app mut App) time() {
|
||||
fn (mut app App) time() {
|
||||
app.vweb.text(time.now().format())
|
||||
}
|
||||
|
@@ -17,27 +17,27 @@ fn main() {
|
||||
vweb.run<App>(port)
|
||||
}
|
||||
|
||||
pub fn (app mut App) init() {
|
||||
pub fn (mut app App) init() {
|
||||
app.vweb.handle_static('.')
|
||||
}
|
||||
|
||||
pub fn (app mut App) json_endpoint() {
|
||||
pub fn (mut app App) json_endpoint() {
|
||||
app.vweb.json('{"a": 3}')
|
||||
}
|
||||
|
||||
pub fn (app mut App) index() {
|
||||
pub fn (mut app App) index() {
|
||||
app.cnt++
|
||||
$vweb.html()
|
||||
}
|
||||
|
||||
pub fn (app mut App) reset() {
|
||||
pub fn (mut app App) reset() {
|
||||
}
|
||||
|
||||
pub fn (app mut App) text() {
|
||||
pub fn (mut app App) text() {
|
||||
app.vweb.text('Hello world')
|
||||
}
|
||||
|
||||
pub fn (app mut App) cookie() {
|
||||
pub fn (mut app App) cookie() {
|
||||
app.vweb.set_cookie('cookie', 'test')
|
||||
app.vweb.text('Headers: $app.vweb.headers')
|
||||
}
|
||||
|
Reference in New Issue
Block a user