prxy
Client/Server wrapper for simple modules with top level functions that return promises or streams.
API
serve(modules, options)
Start an http server proxy for the given module.
modules
- the module to proxy. The top level async functions (that return promises or streams) will be proxied. To proxy multiple modules, pass an array of objects with keyapi
specifying the module andns
specifying the namespace (omit to use default namespace).options
- server optionsport
- port to listen on
load(options)
Configure how to communicate with a remote service.
options
- client optionsurl
- The url to access the remote serivce (e.g. http://remotehost:1234)ns
- The namespace associated with the service (omit to use default)local
- Alternative to load a local module directly (absolute file path or module from package.json)
Usage
Server
const Prxy = ; const math = add: async { return a + b; } Prxy;
Client
const Prxy = ;const MathService = Prxy;const result = await MathService;console;