Server API Reference
Install from npm. This will give your project access to the BrixxServerApi.
npm i @brixxbox/brixx-server-api
Reference the Class BrixxServerApi from your function source.
const BrixxServerApi = require('@brixxbox/brixx-server-api');
Create an instance from BrixxServerApi to access the avialable methods.
//Note: the constructor will always get the 2. parameter from
//the functions call as parameter. This parameter expects the brixxboxMeta
//as part of the body content (req.body.brixxboxMeta)
const brixxServerApi = new BrixxServerApi(req);
Now the different methods from brixxServerApi can be called.
const BrixxServerApi = require('@brixxbox/brixx-server-api');
module.exports = async function (context, req) {
const brixxServerApi = new BrixxServerApi(req);
currencyRate = await brixxServerApi.businessBrixx({
functionName:"CurrencyConverter",
methodName: "Convert",
fromCurrencySymbol: "EUR",
toCurrencySymbol: "USD"
});
//result back to caller (if needed)
context.res = {
status: 200,
body: {
responseMessage: 'Rate EUR/USD: ' + currencyRate,
currencyRate: currencyRate
}
};
}
Last modified 7mo ago