@abtnode/service-loader

Aggregator to mount and make sure all blocklet services run in the same process

Usage no npm install needed!

<script type="module">
  import abtnodeServiceLoader from 'https://cdn.skypack.dev/@abtnode/service-loader';
</script>

README

ABT Node Service Server

Aggregator to mount all blocklet services and make them work together.

Usage

yarn add @abtnode/service-server

Then:

const createServer = require('@abtnode/service-server');
const ABTNode = require('@abtnode/core');

const node = ABTNode({ ...nodeOptions });
const server = createServer(node, { ...globalOptions });

server.mountService('@abtnode/auth-service', { ...loginServiceOptions });
server.mountService('@abtnode/acl-service', { ...aclServiceOptions });
server.mountService('@abtnode/payment-service', { ...paymentServiceOptions });

node.onReady(() => {
  server.listen(5000, () => {
    console.log('ABT Node Service server ready on port 5000');
  });
});

FAQ?

Service Options vs Configurations

  • Options: alter global ways that service works, such as dataDir, the loader and each service can have their own options, and the loader options are merged into service options
  • Configurations: customize how each service handles the request on a certain URL mapping