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:
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.
|
||||
|
||||
`vtalk.v` contains all GET and POST actions.
|
||||
|
||||
```
|
||||
```Go
|
||||
pub fn (app mut App) index() {
|
||||
posts := app.find_all_posts()
|
||||
$vweb.html()
|
||||
@ -25,7 +29,7 @@ pub fn (app App) post() {
|
||||
|
||||
`index.html` is an example of the V template language:
|
||||
|
||||
```
|
||||
```html
|
||||
@for post in posts
|
||||
<div class=post>
|
||||
<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.
|
||||
|
||||
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
Block a user