@abtnode/service-loader 中文文档教程

发布于 3年前 浏览 18 更新于 3年前

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
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文