This repository provides small examples of using Amazon Web Service's Lambda service with Alma use cases. Each example is self-contained and sits in its own directory in this repository.
On any machine with Node.js and Git installed, do the following:
git clone https://github.com/jweisman/AWS-Lambda-POC.git
npm install
config-example.json
file to config.json
and replace the placeholder values.
alma_host
and alma_path
from the Alma API Getting Started Guideapi_key
from the Ex Libris Developer Network dashboardnode_modules
into a zip fileaws lambda update-function-code --function-name MyFunctionName --zip-file fileb://MyFunctionZip.zip
You can test the Lambda function locally using a script such as the one below:
// Our Lambda function fle is required
var myLambda = require('./index.js');
// The Lambda context "done" function is called when complete with/without error var context = {
done: function (err, result) {
console.log('------------');
console.log('Context done');
console.log(' error:', err);
console.log(' result:', result);
}
};
// Create an event if required for your function
var event = {
};
// Call the Lambda function
myLambda.handler(event, context);
The code for these samples is made available under the MIT license.