Hattip adapter for Fastly.
Assuming you have your Hattip handler defined in handler.js
, create an entry file like the following:
import fastlyAdapter from "@hattip/adapter-fastly";
import handler from "./handler.js";
export default fastlyAdapter(handler);
To serve static assets, scaffold a project with Fastly Static Publisher. Put your Hattip handler in src/handler.js
and replace src/index.js
with the following:
import fastlyAdapter from "@hattip/adapter-fastly";
import handler from "./handler.js";
import { getServer } from "./statics.js";
const staticContentServer = getServer();
export default fastlyAdapter(async (ctx) => {
const response = await staticContentServer.serveRequest(ctx.request);
if (response != null) {
return response;
}
return handler(ctx);
});
export interface FastlyPlatformInfo {
/** Platform name */
name: "fastly-compute";
/** Event object */
event: FetchEvent;
}
- Fastly doesn't support constructing a
Request
object with a stream body. - Fastly doesn't support the
AES-GCM
crypto algorithm used by@hattip/session
'sEncryptedCookieStore
.