The backend server can be extended with generic or application-specific modules.

Configuring modules

Modules are enabled in the configuration file, or using the configure-modules helper script.

To list all modules, type:


To enable, disable or remove modules, type:

./configure-module enable PdfUniteRequests
./configure-module disable SvgToPdfRequests
./configure-module disable ZipRequests

Restart the backend server to apply the changes:

sudo systemctl restart GenericBackendService

Writing a module

A module has the following structure:

requestHandlers.push(new ExampleRequests(data, temporaryFolder));

function ExampleRequests(data, temporaryFolder) {
	this.process = function(r) {
		return r.handleUrl('/backend/my', {post, postPreflight});

		function postPreflight(onDone) {
			data.accounts.allowForGlobalOrigins(r, 'POST');

		function post() {
			data.accounts.readAccountAndData(r, ready);

			function ready(account, bytes) {
				if (! account.allowForOrigins(r, 'POST')) return r.forbidden('Invalid origin.');
				if (! account.configuration.child('example').boolean()) return r.forbidden('Missing "example" permission.');

				const message = data.query.parseBytes(bytes);
				const a = message.child('a').number();
				const b = message.child('b').number();
				if (isNaN(a)) return r.badRequest('Invalid A.');
				if (isNaN(B)) return r.badRequest('Invalid B.');
				r.replyWithJson(200, {product: a * b});