npm version
Build Status


npac adapter with webServer api, using Express.js

It is a complete web server, that loads the API specification from swagger/OpenApi descriptors.

Use the public startup and shutdown functions defined in src/index.js within an npac container.
To learn more about the functions visit the homepage.
See also the test cases in src/index.spec.js as examples of how to configure and use the module.


Run the install command:

npm install --save npac-webserver-adapter


This module uses the config.webServer property to gain its configuration parameters.

The default parameters can be found in src/config.js:

    webServer: {
        logBlackList: getLogBlackList(process.env.WEBSERVER_LOG_BLACKLIST),
        port: process.env.WEBSERVER_PORT || 3007,
        useCompression: process.env.WEBSERVER_USE_COMPRESSION || false,
        useResponseTime: process.env.WEBSERVER_USE_RESPONSE_TIME || false,
        usePdms: process.env.WEBSERVER_USE_PDMS || false,
        pdmsTopic: process.env.WEBSERVER_PDMS_TOPIC || 'easer',
        middlewares: { preRouting: [], postRouting: [] },
        restApiPath: process.env.WEBSERVER_RESTAPIPATH || __dirname,
        staticContentBasePath: process.env.WEBSERVER_STATIC_CONTENT_BASEPATH || path.resolve(),
        ignoreApiOperationIds: process.env.WEBSERVER_IGNORE_API_OPERATION_IDS || false,
        enableMocking: process.env.WEBSERVER_ENABLE_MOCKING || false,
        basePath: process.env.WEBSERVER_BASEPATH || '/',
        oasConfig: {
            parse: {
                yaml: {
                    allowEmpty: false // Don't allow empty YAML files
                resolve: {
                    file: true // Resolve local file references