> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Express

> Mount the Corsair /api/corsair route in an Express app.

`toExpressHandler` turns your Corsair instance into Express middleware. That one route serves both Hub's server-to-server delivery and the management API.

## Configure Corsair

```ts corsair.ts theme={null}
import { createCorsair } from 'corsair';
import { github } from '@corsair-dev/github';

export const corsair = createCorsair({
    plugins: [github({ authType: 'managed' })],
    database: db,
    kek: process.env.CORSAIR_KEK!,
    hub: {
        projectApiKey: process.env.CORSAIR_DEV_API_KEY!,
        signingSecret: process.env.CORSAIR_DEV_SIGNING_SECRET!,
    },
});
```

## Mount the route

```ts server.ts theme={null}
import express from 'express';
import { toExpressHandler } from 'corsair';
import { corsair } from './corsair';

const app = express();

// Required: Hub delivers results as JSON POSTs. The adapter reads the parsed
// body, so express.json() must run before the Corsair route.
app.use(express.json());
app.use('/api/corsair', toExpressHandler(corsair, { basePath: '/api/corsair' }));

app.listen(3000);
```

<Warning>Mount `express.json()` **before** the Corsair route. Without it, `req.body` is undefined and Hub's delivery POSTs arrive empty — connects will look like they hang.</Warning>

## Run and go green

Start the server and hit it once. On the first request the app self-registers its delivery URL with Hub and the dashboard header dot turns green. If it stays grey, your route isn't reachable at `/api/corsair` — check the mount path and [Delivery URLs](/hub/delivery-urls).
