Serve
Serve is a fairly platform-agnostic generic service application written using C++ and Qt which executes Javascript code in the spirit of Node.js.

A simple configuration file can be placed at /etc/serve.ini which can define a few defaults:

  • stripColours=false
  • cleanup=true

These parameters expect a comma separated list of paths:

  • modulePaths=/usr/local/lib/Serve/modules,/lib/Serve/modules
  • includeConfs=/etc/serve/debug.ini,/etc/serve/colourful.ini

By itself, Serve has very few basic functions:


Methods

Functionality comes from modules or including additional Javascript files.

Modules I've written for it are also in the portfolio to browse through:

helloworld.js:

	Serve.print("Hello, world!");
		

echoserver.js:

	/* Modules load into a context variable. */
	var WSS = Serve.module("Websocket");

	/* "Any" is special and means :: and 0.0.0.0 */
	var wss = WSS.listen("Any", 9096);

	/* In this example, simply accept incoming websocket connections and echo
	 * back anything received.
	 */
	wss.newConnection.connect( function() {
	    var ws = wss.accept();
	
	    Serve.print("New connection.");
	    ws.received.connect( function(packet) {
	        Serve.print("New packet: "+packet);
	        try {
	            ws.transmit("You said: "+packet);
	        } catch(e) {
	            Serve.print("Error handling packet: "+e);
	        }
	    } );
	} );
			

Page generated in 1.505662ms.

Design based on Falkon design, which is in turn based on the Swift theme for Jekyll.

Highlight.js used in portfolio section for syntax highlighting.