Processing Common Handler Node Js Code in MCS
Summary
Processing Common Handler Node Js Code in MCSContent
Hi,
In my custom api nodejs code i am putting the common get and post in a common service handler file.
Something like this
module.exports = {
function (req, res, connector) ;
var errorMsg;
var finalResponse;
var headerIndex = JSON.stringify(
req.headers).search('application/json');
var versionNumberIndex = JSON.stringify(
req.headers).search('x-api-version');
var reqBody = JSON.stringify(req.body);
console.info('Req body ' + reqBody);
res.header('Access-Control-Allow-Origin','*');
if (0 > headerIndex) {
finalResponse = jbuilder.encode(function (json) {
json.set('Response', function (json) {
json.set('responseCode', '415');
json.set('responseMessage', 'Unsupported media-type');
});
});
res