1
0
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:
yuyi
2020-05-17 19:51:18 +08:00
committed by GitHub
parent b138cadbcb
commit 7f4cf08516
87 changed files with 492 additions and 480 deletions

View File

@@ -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())
}

View File

@@ -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')
}