valvalio / valval Goto Github PK
View Code? Open in Web Editor NEWThe fastest web framework in V language (vlang)
License: MIT License
The fastest web framework in V language (vlang)
License: MIT License
Hi,
I'm using ArangoDB and they have a HTTP Rest API to deal with. I'm also currently using Lua / openresty for my code. Lua has a nice feature called coroutine
which allow you to write your code as simply as :
-- do anything here
http.simple({ url = url, method = method, body = body, headers = headers })
-- do anything here
The code will not be a blocking code and the http response will be handled when the service respond.
Can we do that within VLang ?
register()
。还没人用 V 和 valval,真没必要在这个阶段考虑向后兼容的问题。app.route('POST:/book', function3) // http://127.0.0.1/book by POST
app.route('DELETE:/book', function4) // http://127.0.0.1/book by DELETE
也许增加个函数用于接收 http method?例如:
app.routeX('/book', function3, ['POST'])
app.routeX('/book', function4, ['DELETE'])
app.route_get('/book', function3)
app.route_delete('/book', function4)
App
能否扩展一下,直接传入一个 map,里面可以有参数:
例如:
struct Cfg {
debug bool = false
static_dirs map[string]string
listen_address string = '127.0.0.1'
listen_port int = 8012
}
fn main() {
cfg := Cfg{debug: false, static_dirs: {'/dir1': '/opt/www/dir1'}, listen_address: '0.0.0.0', listen_port: 8012}
mut app := valval.new_app(cfg)
app.route('/', hello)
valval.runserver()
}
I'm on version 0.1.29 of V and I'm getting lots of errors when trying to use valval.
Is there any progress on upgrading it to support a later version? Otherwise I'll give it a shot and might throw up a PR for it. Just wanna check first so I'm not doing work someone else already started.
Environment:
V 0.1.30 1ee5764
CentOS Linux release 8.2.2004 x86_64
V is compiled from sources.
When trying to run Valval example from https://github.com/valvalio/valval/blob/master/example/example.v
Getting plenty of errors. Among them:
~/.vmodules/valval/valval.v:200:2: error: unnecessary `()` in `if` condition, use `if expr {` instead of `if (expr) {`.
~/.vmodules/valval/valval.v:204:2: error: unnecessary `()` in `if` condition, use `if expr {` instead of `if (expr) {`.
~/.vmodules/valval/valval.v:233:22: error: unknown function: net.listen
~/.vmodules/valval/valval.v:234:29: error: unexpected `or` block, the function `accept` does not return an optional
~/.vmodules/valval/valval.v:235:20: error: unexpected `or` block, the function `close` does not return an optional
~/.vmodules/valval/valval.v:240:22: error: invalid argument 1 to `readall`: expected `net.Socket`, not `void`
~/.vmodules/valval/valval.v:243:26: error: unexpected `or` block, the function `write` does not return an optional
~/.vmodules/valval/valval.v:245:26: error: unexpected `or` block, the function `write` does not return an optional
etc
Is this Valval version functional/working? What V version does it support?
Full errors log is attached here:
valval_sample_errors.txt
C:\Users\Administrator>v install valval Skipping module "valval", since it is missing name or url information.
Please update it if it is convenient for you ,thank you !
error: const names cannot contain uppercase letters, use snake_case instead
11 |
12 | const (
13 | VERSION = '0.1.4'
| ~~~~~~~
14 | V_VERSION = '0.1.24'
15 | HTTP_404 = 'HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\n\r\n404 Not Found'
v 0.4.2
Hi,
The current description of valval
is "The fastest web framework in V language", but what proves that it's the fatest? Did you make any benchmark about it? I mean, there are some other V frameworks as vex, and nothing tell me that valval
is fatest.
Maybe create a benchmark about it?
Thanks for your work, Olyno
register()
is used to register a route path, then why not make it clearer with route()
directly?valval.Request
and valval.Response
to valval.Req
, valval.Res
? Shorter, but still clear.Templating engine uses by valval has same syntax as vue...
is there a way to override the v- syntax to e.g. x-, coz i u use vue also in the template
that would be capture by valval templating engine instead of vue rendering it...
Maybe you could do some web framework benchmark within valval
and others.
The claim "Valval is the fastest web framework in V language." is a bit weird to say if there aren't any benchmarks to show for?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.