Getting Started
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.
Prerequisites
- If you have not already done so, sign up for an OSC account.
Step 1: Create a Lambda instance
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.
Step 2: Create a sample application
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
Step 3: Upload sample application
Upload the zip file to the server (using curl for example)
% curl -v -F upload=@example.zip -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.
Step 4: Run sample application
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"}