Files
sweet/tests/fixture/routes/intercept.tsx
T
Luca Casonato cbbf616a74 chore: version preact explicitly in import map (#258)
This allows users to control the `preact` version independently of fresh
itself.
2022-06-20 12:37:24 +02:00

21 lines
456 B
TypeScript

/** @jsx h */
import { h } from "preact";
import { HandlerContext } from "$fresh/server.ts";
export default function Page() {
return <div>This is HTML</div>;
}
export const handler = {
GET(req: Request, { render }: HandlerContext) {
if (req.headers.get("accept")?.includes("text/html")) {
return render();
} else {
return new Response("This is plain text");
}
},
POST() {
return new Response("POST response");
},
};