Re: [Vala] Need some feedback for Valum, a web micro-framework!
- From: Al Thomas <astavale yahoo co uk>
- To: "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] Need some feedback for Valum, a web micro-framework!
- Date: Mon, 29 Jun 2015 22:37:18 +0000 (UTC)
From: Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
Sent: Saturday, 27 June 2015, 16:35
Subject: Re: [Vala] Need some feedback for Valum, a web micro-framework!
Modules is just a pattern to simplify and decouple an application in
reusable pieces, so I have never thought about hot plugging them.
There is GModule or probably better, libpeas. The idea of being able
to create loadable modules, for example for authorization, menus,
pagination, etc., seems useful to me.
I note one of your examples uses Genie
( https://github.com/valum-framework/valum/blob/master/examples/app/main.gs ).
The Genie example is broken...
Ah yes, Genie support for anonymous functions is very limited at the moment.
If you are feeling adventurous download this patch
https://bug746704.bugzilla-attachments.gnome.org/attachment.cgi?id=306096
for valac and change
var handler = def (req, res)
res.append(lua.eval("print 'hi from lua string'"))
to
handler:VSGI.ApplicationCallback = def (req, res)
res.append(lua.eval("print 'hi from lua string'"))
More practically:
[indent=2]
namespace ValumGenie.TestApp
init
var app = new Valum.Router()
app.get("/", handler)
var server = new Valum.FastCGI.Server( app.handle )
server.run( args )
def handler (req:VSGI.FastCGI.Request, ref res:VSGI.FastCGI.Response)
var lua = new Valum.Script.Lua()
res.append(lua.eval("print 'hi from lua string'"))
should get a little closer to working (untested).
As an aside, if anyone is interested in making constructive comments on
support for anonymous functions in Genie, please take a look at
https://bugzilla.gnome.org/show_bug.cgi?id=746704
Finally how flexible is CTPL as the templating engine?>CTPL can do certain things like passing variables,
looping and
branching, but it lacks some features like filters, maps and
inheritence (or just embedding).
It's not even comparable to Twig or Jinja2, but it works and it can do
some of the job.
I plan to write a Mustache implementation, but for now I think that the
best thing the framework should focus on is its ability to describe web
services. The code will be hosted here:
https://github.com/valum-framework/mustache-glib
OK, seems like Valum is more web services focussed at the moment.
Mustache seems interesting. Looks as thought some form of inheritance
may be possible:
http://stackoverflow.com/questions/7925931/can-mustache-templates-do-template-extension
This is useful for the reasons:
https://github.com/mustache/spec/pull/75
Thanks for the JSON examples,
Al
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]