This is a Hello World! example, the code does not has to be compiled:
// ============================================================================
// C servlet sample for the G-WAN Web Application Server (http://trustleap.ch/)
// ----------------------------------------------------------------------------
// hello.c: just used with Lighty's Weighttp to benchmark a minimalist servlet
// ============================================================================
// imported functions:
// get_reply(): get a pointer on the 'reply' dynamic buffer from the server
// xbuf_cat(): like strcat(), but it works in the specified dynamic buffer
// ----------------------------------------------------------------------------
#include "gwan.h" // G-WAN exported functions
int main(int argc, char *argv[])
{
xbuf_cat(get_reply(argv), "Hello World!");
return 200; // return an HTTP code (200:'OK')
}
// ============================================================================
// End of Source Code
// ============================================================================
Now start the server:
sudo ./gwan
and enjoy: http://localhost:8080/csp?hello1.c
I wonder if, in a near future, we will have a super fast REST backend with a thick Javascript interface made with Backbone.js and JQuery.
