ls-deno/routes/_middleware.ts

16 lines
313 B
TypeScript
Raw Normal View History

2022-09-27 14:41:17 -05:00
import { MiddlewareHandlerContext } from "$fresh/server.ts";
interface State {
data: string;
}
export async function handler(
_: Request,
ctx: MiddlewareHandlerContext<State>,
) {
ctx.state.data = "myData";
const resp = await ctx.next();
resp.headers.set("server", "fresh server");
return resp;
}