5.3.0 • Published 10 months ago

@mimik/init v5.3.0

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
10 months ago

init

Example

const init = require('@mimik/init');

init(config, dbValidate, { postOps: [suscribe] }).then(result => config = result);

module.exports(app, rootDir, config, validates, cluster, options) ⇒ object

Init process for a micro-service.

Kind: Exported function
Returns: object - The updated configuration.

The secOptions has the following structure:

 {
   preOps: [function], // functions to process before starting the micro-service
   postOps: [function], // functions to process after starting the micro-service
   exitOps: [function], // functions to process before exiting the micro-service
   secOptions: { securityDefinition: function }, // extra security options to validate the API request
   extractName: string, // ability to extract data from the req and send it to a logging environment
   metrics: object, // to genetrate information for `/metrics`
 }

The return object has the following strucuture:

 {
   config: The configuration object,
 }

For the preOps, postOps and exitOps the function are executed with 3 parameters (correlationId, config, server). The following routes are reserved: /healthcheck and /metrics. The base path is defined by taking the url property of the first item of the servers array in the api defintion file. Only relative url address will be handled (e.g. /mss/v1) and templates in the url are not allowed.

ParamTypeDescription
appobjectThe app implementing the micro-service.
rootDirPATH.<string>The root directory of the micro-service.
configobjectConfiguration of the micro-service.
validatesarrayArray of Promises to validate dependent systems (database, topic).
clusterPromisePromise to be used for cluster management and registration.
optionsobjectoptions to start the micro-service. The options can be null.
5.2.2

12 months ago

5.3.0

10 months ago

5.2.1

12 months ago

5.0.3

1 year ago

5.2.0

12 months ago

5.1.0

1 year ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

3.9.2

2 years ago

3.8.2

2 years ago

3.8.1

2 years ago

3.9.5

2 years ago

3.9.4

2 years ago

3.8.0

2 years ago

3.7.5

2 years ago

3.7.4

2 years ago

3.7.3

2 years ago

3.7.2

2 years ago

3.7.1

2 years ago

3.6.2

3 years ago

3.7.0

2 years ago

3.6.1

3 years ago

3.6.0

4 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago