Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.2 KB

File metadata and controls

27 lines (18 loc) · 1.2 KB

Fetch

The fetch method in your created integration allows you to handle incoming requests to your integration.

It can be defined in an async function inside the createIntegration call, and includes 2 arguments. The function should return a valid Response.

fetch: async (request, context) => {
    return new Response(JSON.stringify(data), {
        headers: {
          "Content-Type": "application/json",
        } 
    }
}

request

The incoming request object that is sent to your integration. See the MDN docs to learn more.

context

Context about your integration, including the environment and installation details the integration is running in.

This object contains the following keys:

NameDescription
environmentEnvironment of the integration. See the Environment section to learn more.
apiAuthenticated client to the GitBook API. See the API docs to learn more.