@abtnode/service-loader 中文文档教程
ABT Node Service Server
用于安装所有 Blocklet 服务并使它们协同工作的聚合器。
Usage
yarn add @abtnode/service-server
然后:
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
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