update vweb readme
parent
626da27ad6
commit
5bb8416baf
|
@ -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.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue