var fs = require("fs");
let moduleConfiguration = JSON.parse(fs.readFileSync('moduleConfiguration.json', 'utf8'));
module.exports = function(driver) {
/**
* Function to retrieve the file manifest of the Drivers component
* @param {string} driverId Driver ID
* @callback {Function} callback Callback function
* @param {Error|string} err Error object
* @param {manifestDoc} result Result object
*/
driver.getManifest = function(callback) {
let driverMetadata = require("../driverImplementation/"+ moduleConfiguration.driver)().getDriverMetadata();
callback(null, driverMetadata);
/*
var err0 = new Error('Invalid input');
err0.statusCode = 405;
return cb(err0);
*/
}
driver.remoteMethod('getManifest',
{ isStatic: true,
produces: [ 'application/json' ],
accepts: [],
returns:
[ { description: 'manifest',
type: 'manifestDoc',
arg: 'data',
root: true } ],
http: { verb: 'get', path: '/drivers/manifest' },
description: 'Function to retrieve the file manifest of the Drivers component' }
);
}