UNPKG

@mediarithmics/plugins-nodejs-sdk

Version:

This is the mediarithmics nodejs to help plugin developers bootstrapping their plugin without having to deal with most of the plugin boilerplate

17 lines (16 loc) 665 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ProductionPluginRunner { constructor(plugin) { this.plugin = plugin; } // Start a server serving the plugin app // A port can be provided to run the server on it start(port) { const pluginPort = process.env.PLUGIN_PORT; this.pluginPort = pluginPort ? parseInt(pluginPort) : 8080; const serverPort = port ? port : this.pluginPort; this.server = this.plugin.app.listen(serverPort, () => this.plugin.logger.info("Plugin started, listening at " + serverPort)); } } exports.ProductionPluginRunner = ProductionPluginRunner;