Files
sweet/tests/fixture/routes/intercept_args.tsx
T
Luca Casonato b12867a582 feat: support JSX automatic mode (#610)
This commit adds support for JSX automatic mode instead of the default
mode that requires the presence of the JSX pragma in each file.

This commit also adds the config file to the `fresh.gen.ts` manifest,
which is used to determine if the client emit should use automatic mode.

The minimum Deno version has also been bumped to 1.25.0.
2022-08-26 11:03:00 +02:00

25 lines
540 B
TypeScript

import { Handlers, PageProps } from "$fresh/server.ts";
interface Data extends Record<string, unknown> {
info: string;
}
export default function Page({ data }: PageProps<Data>) {
return <div>{data.info}</div>;
}
export const handler: Handlers<Data> = {
GET(req, { render }) {
if (req.headers.get("accept")?.includes("text/html")) {
return render({
info: "intercepted",
});
} else {
return new Response("This is plain text");
}
},
POST() {
return new Response("POST response");
},
};