---
title: Hono
description: Mount the Files gateway in a Hono app. Web-native, so it runs anywhere Hono does - Cloudflare Workers, Bun, Deno, and Node.
---

`files-sdk/hono` mounts a [`createFilesRouter`](/ui/server/gateway) in a Hono app. Like the [Next binding](/ui/server/next) it is Web-native, so it runs anywhere Hono does — **Cloudflare Workers, Bun, Deno, and Node**.

`createRouteHandler` returns a single handler. Mount it with `app.all` so all three methods reach the gateway — it dispatches on the method internally (GET = download, POST = the JSON verbs, PUT = upload) and addresses everything by query string, so one fixed path is enough.

```ts title="server.ts" lineNumbers
import { Hono } from "hono";
import { createFiles } from "files-sdk";
import { s3 } from "files-sdk/s3";
import { createFilesRouter } from "files-sdk/api";
import { createRouteHandler } from "files-sdk/hono";

const router = createFilesRouter({
  files: createFiles({ adapter: s3({ bucket: "uploads" }) }),
  allowedOrigins: ["https://app.example.com"],
  authorize: async ({ req }) => {
    /* throw to deny, or return a per-user constraint — see /ui/server/authorization */
  },
});

const app = new Hono();
app.all("/api/files", createRouteHandler(router));

export default app;
```

See the [gateway options](/ui/server/gateway) for the full configuration and the [`authorize`](/ui/server/authorization) model for locking it down.
