16 lines
323 B
TypeScript
16 lines
323 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();
|
|
if (resp) resp.headers.set("server", "fresh server");
|
|
return resp;
|
|
}
|