Service: Birme Lambda - EyevinnOSC/community GitHub Wiki
The open source project Birme Lambda provides a quick way to run code initiated by an HTTP request. Upload a zip file with Javascript / Typescript code that you want to execute.
- If you have not already done so, sign up for an OSC account.
Click on the button "Create lambda" in the web user interface.
Enter the name of the lambda, for example guide
. When created the Lambda is available at https://<tenant>-guide.birme-lambda.auto.prod.osaas.io
where <tenant>
is the id of your tenant.
Create a sample application with the following code in a file called index.js
:
exports.handler = async (event) => {
console.log(event);
const res = {
body: {
message: 'hello world'
}
};
return res;
}
Package the file in a zip file
% zip example.zip index.js
Upload the zip file to the server (using curl for example)
% curl -v -F [email protected] -H 'Authorization: Bearer <SAT>' https://<tenant>-guide.birme-lambda.auto.prod.osaas.io/upload
Replace <SAT>
with the service access token. See documentation on how to acquire the service access token.
To run the sample application you send an HTTP request to the /event
endpoint, e.g.
% curl -v -X POST -H 'Content-Type: application/json' -d '{ "hej": "hopp" }' https://eyevinn-test.birme-lambda.auto.prod.osaas.io/event
{"message":"hello world"}