16 lines
313 B
TypeScript
16 lines
313 B
TypeScript
|
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;
|
||
|
}
|