fwsp-hydra-express
Version:
A module which wraps Hydra and ExpressJS to provide an out of the box microservice which can support API routes and handlers.
37 lines (33 loc) • 889 B
JavaScript
;
const HydraPlugin = require('fwsp-hydra/plugin');
/**
* @name HydraExpressPlugin
* @description Extend this for hydra-express plugins
* @extends HydraPlugin
*/
class HydraExpressPlugin extends HydraPlugin {
/**
* @param {string} pluginName - unique name for the plugin
*/
constructor(pluginName) {
super(pluginName);
}
/**
* @name setHydraExpress
* @param {object} hydraExpress - hydra express instance
*/
setHydraExpress(hydraExpress) {
this.setHydra(hydraExpress.getHydra());
this.hydraExpress = hydraExpress;
}
/**
* @name setConfig
* @param {string} serviceConfig - the service-level config
* @param {object} serviceConfig.hydra - the hydra-level config
*/
setConfig(serviceConfig) {
super.setConfig(serviceConfig.hydra);
this.serviceConfig = serviceConfig;
}
}
module.exports = HydraExpressPlugin;