17 | Welcome to `fresh`. Try updating this message in the ./routes/index.tsx
18 | file, and refresh.
19 |
20 |
21 |
22 | >
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/fresh.gen.ts:
--------------------------------------------------------------------------------
1 | // DO NOT EDIT. This file is generated by fresh.
2 | // This file SHOULD be checked into source version control.
3 | // This file is automatically updated during development when running `dev.ts`.
4 |
5 | import config from "./deno.json" assert { type: "json" };
6 | import * as $0 from "./routes/[name].tsx";
7 | import * as $1 from "./routes/api/joke.ts";
8 | import * as $2 from "./routes/index.tsx";
9 | import * as $$0 from "./islands/Counter.tsx";
10 |
11 | const manifest = {
12 | routes: {
13 | "./routes/[name].tsx": $0,
14 | "./routes/api/joke.ts": $1,
15 | "./routes/index.tsx": $2,
16 | },
17 | islands: {
18 | "./islands/Counter.tsx": $$0,
19 | },
20 | baseUrl: import.meta.url,
21 | config,
22 | };
23 |
24 | export default manifest;
25 |
--------------------------------------------------------------------------------
/static/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/routes/api/joke.ts:
--------------------------------------------------------------------------------
1 | import { HandlerContext } from "$fresh/server.ts";
2 |
3 | // Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
4 | const JOKES = [
5 | "Why do Java developers often wear glasses? They can't C#.",
6 | "A SQL query walks into a bar, goes up to two tables and says “can I join you?”",
7 | "Wasn't hard to crack Forrest Gump's password. 1forrest1.",
8 | "I love pressing the F5 key. It's refreshing.",
9 | "Called IT support and a chap from Australia came to fix my network connection. I asked “Do you come from a LAN down under?”",
10 | "There are 10 types of people in the world. Those who understand binary and those who don't.",
11 | "Why are assembly programmers often wet? They work below C level.",
12 | "My favourite computer based band is the Black IPs.",
13 | "What programme do you use to predict the music tastes of former US presidential candidates? An Al Gore Rhythm.",
14 | "An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.",
15 | ];
16 |
17 | export const handler = (_req: Request, _ctx: HandlerContext): Response => {
18 | const randomIndex = Math.floor(Math.random() * JOKES.length);
19 | const body = JOKES[randomIndex];
20 | return new Response(body);
21 | };
22 |
--------------------------------------------------------------------------------