Serverless functions are an integral part of the Forge platform, enabling developers to create custom, scalable applications that interact and extend seamlessly with Atlassian's suite of products. Functions underpin many other foundational capabilities of the platform, including UI backend resolvers, product events, and more.
The following dependency should be installed at the top-level directory of your app:
1 2npm i @forge/api@latest
The following directory and function entry point file should be added to your app /src
folder:
1 2/src /backend /index.js
The following function handler should be defined in the /src/backend/index.js
file:
1 2export const handler = (...args) => { console.log(args); // Do something }
The following function should be declared in the app manifest:
1 2modules: function: - key: backend handler: index.handler
To enable your function to run, it needs to be attached to a module via the app manifest. For example, a scheduled trigger:
1 2modules: scheduledTrigger: - key: example function: backend interval: hour # Runs hourly
See common modules for a complete list of backend entry points.
Rate this page: