vweb: readme: list some features of vweb

pull/3029/head
Alexander Medvednikov 2019-12-10 00:16:39 +03:00
parent cd54b2878e
commit 0650d58818
1 changed files with 21 additions and 13 deletions

View File

@ -1,12 +1,20 @@
This is pre-alpha software.
## Features
- Very fast: performance of C on the web.
- Small binary: hello world website is <100 KB.
- Easy to deploy: just one binary file that also includes all templates.
No need to install any dependencies.
- Templates are precompiled, all errors are visible at compilation time,
not at runtime.
Lots of things are broken and not implemented yet in V and vweb.
There's no documentation yet, have a look at a simple example:
There's no documentation yet, have a look at a simple example:
https://github.com/vlang/v/tree/master/examples/vweb/test_vweb_app.v
https://github.com/vlang/v/tree/master/examples/vweb/vweb_example.v
There's also the V forum: https://github.com/vlang/vorum
There's also the V forum: https://github.com/vlang/vorum
`vorum.v` contains all GET and POST actions.
@ -16,16 +24,16 @@ pub fn (app mut App) index() {
$vweb.html()
}
// TODO ['/post/:id/:title']
// TODO `fn (app App) post(id int)`
// TODO ['/post/:id/:title']
// TODO `fn (app App) post(id int)`
pub fn (app App) post() {
id := app.get_post_id()
id := app.get_post_id()
post := app.retrieve_post(id) or {
app.vweb.redirect('/')
return
app.vweb.redirect('/')
return
}
comments := app.find_comments(id)
show_form := true
show_form := true
$vweb.html()
}
@ -34,11 +42,11 @@ pub fn (app App) post() {
`index.html` is an example of the V template language:
```html
@for post in posts
@for post in posts
<div class=post>
<a class=topic href="@post.url">@post.title</a>
<img class=comment-img>
<span class=nr-comments>@post.nr_comments</span>
<a class=topic href="@post.url">@post.title</a>
<img class=comment-img>
<span class=nr-comments>@post.nr_comments</span>
<span class=time>@post.time</span>
</div>
@end