Service. ServiceRunner

new ServiceRunner()

Sandboxed service runner. This runner uses the vm2 package to run end points in a fully isolated context. Endpoints, pre-middleware and post-middleware all run as independant precompiled VMScripts.

Parameters:
NameTypeDescription
options.servicemodule:Service.IService

The service to load endpoints from

options.partymodule:Party.IParty

The party to pass to the endpoints

options.sendFullErrorsboolean

If true send full stack traces to clients. Defaults to false

options.prefixstring

A prefix to apply to all endpoint paths

options.routerRouter

Router, defaults to origin-router

Methods

(static) onRequest(req, res)

Expressjs style way of calling an endpoint. The req will be passed to the router to select the appropritate endpoint

Parameters:
NameTypeDescription
reqExpress.Request
resExpress.Response
Returns: