Module: npac-webserver-adapter

The main module of the webserver adapter.

Methods

(inner) resolveOasFile(container, oasFile) → {String|Object}

Resolve the swagger descriptor to be loaded.

Parameters:
Name Type Description
container Object

The container context

oasFile String | Object

The path string to the swagger file, or the swagger object itself

Returns:

The full path resolved, if it is a path, or the swagger object.

Type
String | Object

(inner) shutdown(container)

The startup function of the adapter.

This function has to be added to the terminators array of the container application to be executed during the startup process.

Parameters:
Name Type Description
container Object

The actual state of the container context during the startup process.

function

The next function that must be called when the startup function has finished.
This is an error-first callback function. Its firs parameter is null if the execution was successful, or the error code, in case of problems.
Its second parameter -in case of successful execution- is the object, that has to be merged with the actual state to the context.

(inner) startup(container)

The startup function of the adapter.

This function has to be added to the adapters array of the container application to be executed during the startup process.

The function will read its configuration from the context.config.webServer propery.
See the config.js file for details on the config parameters.

The function reads the REST API from the swagger/OpenApi descriptor file(s), then starts a webserver according to the config parameter.
See the inde.spec.js for for examples of how to use this function and the adapter itself.

Parameters:
Name Type Description
container Object

The actual state of the container context during the startup process.

function

The next function that must be called when the startup function has finished.
This is an error-first callback function. Its firs parameter is null if the execution was successful, or the error code, in case of problems.
Its second parameter -in case of successful execution- is the object, that has to be merged with the actual state to the context.