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

update vweb readme

This commit is contained in:
Alexander Medvednikov 2019-07-29 19:46:26 +02:00 committed by GitHub
parent 626da27ad6
commit 5bb8416baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,12 @@
This is pre-alpha software.
Lots of things are broken and not implemented yet in V and vweb.
There's no documentation yet, have a look at https://github.com/vlang/vtalk for an example of a simple vweb app. There's no documentation yet, have a look at https://github.com/vlang/vtalk for an example of a simple vweb app.
`vtalk.v` contains all GET and POST actions. `vtalk.v` contains all GET and POST actions.
``` ```Go
pub fn (app mut App) index() { pub fn (app mut App) index() {
posts := app.find_all_posts() posts := app.find_all_posts()
$vweb.html() $vweb.html()
@ -25,7 +29,7 @@ pub fn (app App) post() {
`index.html` is an example of the V template language: `index.html` is an example of the V template language:
``` ```html
@for post in posts @for post in posts
<div class=post> <div class=post>
<a class=topic href="@post.url">@post.title</a> <a class=topic href="@post.url">@post.title</a>
@ -39,3 +43,9 @@ pub fn (app App) post() {
`$vweb.html()` compiles an HTML template into V during compilation, and embeds the resulting code in current action. `$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 environemnt. That means that the template automatically has access to that action's entire environemnt.
### Deploying vweb apps
Everything, including HTML templates, is in one binary file. That's all you need to deploy.