···4455import * as $_404 from "./routes/_404.tsx";
66import * as $_app from "./routes/_app.tsx";
77-import * as $api_joke from "./routes/api/joke.ts";
88-import * as $greet_name_ from "./routes/greet/[name].tsx";
97import * as $index from "./routes/index.tsx";
108import * as $post_slug_ from "./routes/post/[slug].tsx";
119import * as $rss from "./routes/rss.ts";
···1614 routes: {
1715 "./routes/_404.tsx": $_404,
1816 "./routes/_app.tsx": $_app,
1919- "./routes/api/joke.ts": $api_joke,
2020- "./routes/greet/[name].tsx": $greet_name_,
2117 "./routes/index.tsx": $index,
2218 "./routes/post/[slug].tsx": $post_slug_,
2319 "./routes/rss.ts": $rss,
-21
routes/api/joke.ts
···11-import { FreshContext } from "$fresh/server.ts";
22-33-// Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
44-const JOKES = [
55- "Why do Java developers often wear glasses? They can't C#.",
66- "A SQL query walks into a bar, goes up to two tables and says “can I join you?”",
77- "Wasn't hard to crack Forrest Gump's password. 1forrest1.",
88- "I love pressing the F5 key. It's refreshing.",
99- "Called IT support and a chap from Australia came to fix my network connection. I asked “Do you come from a LAN down under?”",
1010- "There are 10 types of people in the world. Those who understand binary and those who don't.",
1111- "Why are assembly programmers often wet? They work below C level.",
1212- "My favourite computer based band is the Black IPs.",
1313- "What programme do you use to predict the music tastes of former US presidential candidates? An Al Gore Rhythm.",
1414- "An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.",
1515-];
1616-1717-export const handler = (_req: Request, _ctx: FreshContext): Response => {
1818- const randomIndex = Math.floor(Math.random() * JOKES.length);
1919- const body = JOKES[randomIndex];
2020- return new Response(body);
2121-};
-5
routes/greet/[name].tsx
···11-import { PageProps } from "$fresh/server.ts";
22-33-export default function Greet(props: PageProps) {
44- return <div>Hello {props.params.name}</div>;
55-}