palmettoflow-service-container

2019-11-10 admin

palmettoflow-service-container是什么

什么是palmettoflow-service-container,An opionatied palmetto flow service container that can load services with a common pattern:

palmettoflow-service-container使用教程帮助文档

Palmetto Flow Service Container

An opionatied palmetto flow service container that can load services with a common pattern:

example

var fetchConfig = require('zero-config')
var config = fetchConfig(__dirname, { dcValue: 'us-east-1'})
var sc = require('palmettoflow-service-container')
sc(config, [
  'service1',
  'service2',
  'service3'
])

The pfsc will initialize the list of services with the following higher order function:

module.exports = function (config) {
  return function (ee) {
    // ... do stuff
  }
}

Using the service container you need the configuration for your services, the adapter and to npm install the services.

If you use zero-config then put the name of your adapter and all of your service’s configuration information by the name of the service.

{
  "adapter": "@twilson63/palmetto-couchdb",
  "palmetto": {
    "endpoint": "",
    "app": ""
  },
  "service1": {
    "config1": "foo",
    "config2": "bar"
  },
  "service2": {
    "config1": "foo"
  }
}

Then npm install the adapter and the service.

npm install zero-config palmettoflow-service-container service1 service2 @twilson63/palmetto-couchdb

Finally, create a file index.js and setup the configuration and services:

var fetchConfig = require('zero-config')
var config = fetchConfig(__dirname, { dcValue: 'us-east-1'})
var sc = require('palmettoflow-service-container')
sc(config, [
  'service1',
  'service2',
  'service3'
])

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-78921.html

文章标题:palmettoflow-service-container

回到顶部