Handler Functions
In any of your applet files, exporting a function called handler
turns that file into a path for your applet. This handler function is the key to capturing inputs, and Zipper uses it to generate your web UI. The handler function receives two arguments: an inputs object and a context object.
export async function handler(
inputs: Inputs,
context: Zipper.HandlerContext
) { ... }
The inputs object
The inputs object that is used to generate a form to collect user information. For more details, see the Accepting Inputs page.
The context object
The context object contains information about the current user, the request, and the response. It has the following shape:
export type HandlerContext = {
/**
* The request object sent to this handler
*/
request: Request;
/**
* An editable response object
* Changes made to these properties will overwrite the default response
*/
response: Partial<ResponseInit & { body: BodyInit }>;
/**
* Information about the user who called this app
* (blank if public)
*/
userInfo: undefined | UserInfo;
/**
* Meta info about the applet itself
*/
appInfo: AppInfo;
/**
* The ID for this particular run
*/
runId: string;
/**
* Auth tokens for each service the user has individually authed against
*/
userConnectorTokens: { [service: string]: string };
};