mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
all: update remaining deprecated attr syntax (#19908)
This commit is contained in:
parent
709976f42e
commit
b347f546f2
11 changed files with 64 additions and 64 deletions
|
@ -49,7 +49,7 @@ It will create `primes.v` with the following contents:
|
|||
|
||||
|
||||
```v
|
||||
[translated]
|
||||
@[translated]
|
||||
module main
|
||||
|
||||
fn is_prime(x int) bool {
|
||||
|
@ -335,4 +335,4 @@ I will also be publishing the same demo with Sqlite and Quake translation.
|
|||
It's a huge milestone for V and gives V developers access to huge amounts of software
|
||||
written in C.
|
||||
|
||||
We're very excited about this release.
|
||||
We're very excited about this release.
|
||||
|
|
|
@ -69,7 +69,7 @@ fn main() {
|
|||
vweb.run(app, 8081)
|
||||
}
|
||||
|
||||
['/index']
|
||||
@['/index']
|
||||
pub fn (mut app App) index() vweb.Result {
|
||||
return app.text('Hello world from vweb!')
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ Create `new.html`:
|
|||
// article.v
|
||||
import vweb
|
||||
|
||||
[post]
|
||||
@[post]
|
||||
pub fn (mut app App) new_article(title string, text string) vweb.Result {
|
||||
if title == '' || text == '' {
|
||||
return app.text('Empty text/title')
|
||||
|
@ -368,7 +368,7 @@ We need to update `index.html` to add a link to the "new article" page:
|
|||
Next we need to add the HTML endpoint to our code like we did with `index.html`:
|
||||
|
||||
```v ignore
|
||||
['/new']
|
||||
@['/new']
|
||||
pub fn (mut app App) new() vweb.Result {
|
||||
return $vweb.html()
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ in V is very simple:
|
|||
// article.v
|
||||
import vweb
|
||||
|
||||
['/articles'; get]
|
||||
@['/articles'; get]
|
||||
pub fn (mut app App) articles() vweb.Result {
|
||||
articles := app.find_all_articles()
|
||||
return app.json(articles)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue