Closed dominuskernel closed 7 years ago
Could you run this with gdb and do a simple backtrace?
I guess that I have to execute this for it no?: valac --pkg=valum-0.3 -o -g build/app src/app.vala
valac --pkg=valum-0.3 -g -o build/app src/app.vala
gdb build/app
Then, when it crashes, enter backtrace
to get the stacktrace.
You're issue is likely caused by varidic arguments for Server.new
, are you sure you're using:
Server.new ("http", handler: app);
Ok when I put like in the documentation Quickstart I get the error:
using Valum;
using VSGI;
var app = new Router ();
app.get ("/", (req, res) => {
return res.expand_utf8 ("Hello world!");
});
Server.new ("http", handler: app.handle).run ({"app", "--port", "3003"});
backtrace:
#0 0x00007ffff70d0931 in () at /usr/lib/libgobject-2.0.so.0
#1 0x00007ffff70d30bc in g_object_new_valist () at /usr/lib/libgobject-2.0.so.0
#2 0x00007ffff79af2a7 in vsgi_server_new_valist () at /usr/lib/libvsgi-0.3.so
#3 0x00007ffff79af53f in vsgi_server_new () at /usr/lib/libvsgi-0.3.so
#4 0x0000000000400b5b in _vala_main () at /home/razorpack/develop/feedReader/src/app.vala:10
#5 0x0000000000400c5f in main (argc=1, argv=0x7fffffffddd8) at /home/razorpack/develop/feedReader/src/app.vala:4
When I write like you mentioned me, the app get up the server.
By default, it doesn't set the Content-Type
header, so you don't get a pretty page as the browser assumes binary data has been transmitted. Try:
app.get ("/", (req, res) => {
res.headers.set_content_type ("text/plain", null);
return res.expand_utf8 ("Hello world!");
});
Or
app.use (ContentNegotiation.accept ("text/html"));
app.get ("/", (req, res) => res.expand_utf8 ("Hello world!"));
Hope that helps. I'll update the docs to be more friendly and actually work. The handle
pattern is from the 0.2
as we now exclusively use Handler
-derived types.
Alternatively, you can checkout https://github.com/valum-framework/example to get started.
You can checkout 0.3.14, I've included many pending fixes and a documentation update ;)
Hello, I installed valum in Manjaro Linux and I tried built the Simple ‘Hello world!’ application with valac and also with Meson and when I run the executable file always I get a segmentation fault.
When I build the app I get this warning: ../src/app.vala:4.1-2.11: warning: main blocks are experimental
valum 0.3.13-1 vala 0.36.3-1