1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: more updates

This commit is contained in:
Alexander Medvednikov
2020-12-31 17:47:20 +01:00
parent fa00f157ad
commit 2bc9ee4d88
4 changed files with 17 additions and 23 deletions

View File

@ -29,7 +29,7 @@ pub fn (app mut App) index() {
pub fn (app App) post() {
id := app.get_post_id()
post := app.retrieve_post(id) or {
app.vweb.redirect('/')
app.redirect('/')
return
}
comments := app.find_comments(id)
@ -52,7 +52,7 @@ pub fn (app App) post() {
@end
```
`$vweb.html()` compiles an HTML template into V during compilation,
`$vweb.html()` compiles an HTML template into V during compilation,
and embeds the resulting code in current action.
That means that the template automatically has access to that action's entire environment.