Slide 17
Slide 17 text
おまけ
v3.3.4 くらいで、こう書けます(予定)
import { Hono } from "hono";
import type { Callback, CloudFrontResponse } from "hono/lambda-edge";
import { handle } from "hono/lambda-edge";
type Bindings = {
callback: Callback;
response: CloudFrontResponse;
};
const app = new Hono<{ Bindings: Bindings }>();
app.all("*", async (c) => {
c.env.response.headers["X-Custom".toLowerCase()] = [
{
key: "X-Custom",
value: "Foo",
},
];
await next();
c.env.callback(null, c.env.response);
});
export const handler = handle(app);