Build serverless apps

Serverless apps are apps that run in response to events such as app installation and uninstallation, events that occur in the Freshservice product (such as, ticket creation, updation, and so on), or events that occur in an external product or service. The Freshworks developer platform includes a serverless environment that enables you to build serverless (back-end) apps. To do this, you can subscribe to these events through event listeners. Event listeners invoke callback methods when the events occur. Serverless computing does involve servers, but they are abstracted from developers. When a configured event occurs, the app logic in the callback method is run on a server, with the help of the event-specific payload passed to the callback method.

When creating a serverless custom app, in your app logic (in server.js), you can include the process.env.ENV environment variable to run different app logic in the test and production environments. To do this, you can use the following syntax:

if(process.env.ENV === "test") {
//do something
if(process.env.ENV === "production") {
//do something else

For a demonstration of this, see the Freshdesk serverless sample app.