├── .gitignore ├── .vscode ├── extensions.json └── settings.json ├── README.md ├── components └── Button.tsx ├── deno.json ├── dev.ts ├── fresh.config.ts ├── fresh.gen.ts ├── islands └── Counter.tsx ├── main.ts ├── routes ├── _404.tsx ├── _app.tsx ├── api │ └── joke.ts ├── greet │ └── [name].tsx └── index.tsx ├── static ├── favicon.ico └── logo.svg └── twind.config.ts /.gitignore: -------------------------------------------------------------------------------- 1 | # dotenv environment variable files 2 | .env 3 | .env.development.local 4 | .env.test.local 5 | .env.production.local 6 | .env.local 7 | 8 | # Fresh build directory 9 | _fresh/ 10 | # npm dependencies 11 | node_modules/ 12 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "denoland.vscode-deno" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.lint": true, 4 | "editor.defaultFormatter": "denoland.vscode-deno", 5 | "[typescriptreact]": { 6 | "editor.defaultFormatter": "denoland.vscode-deno" 7 | }, 8 | "[typescript]": { 9 | "editor.defaultFormatter": "denoland.vscode-deno" 10 | }, 11 | "[javascriptreact]": { 12 | "editor.defaultFormatter": "denoland.vscode-deno" 13 | }, 14 | "[javascript]": { 15 | "editor.defaultFormatter": "denoland.vscode-deno" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fresh project 2 | 3 | Your new Fresh project is ready to go. You can follow the Fresh "Getting 4 | Started" guide here: https://fresh.deno.dev/docs/getting-started 5 | 6 | ### Usage 7 | 8 | Make sure to install Deno: https://deno.land/manual/getting_started/installation 9 | 10 | Then start the project: 11 | 12 | ``` 13 | deno task start 14 | ``` 15 | 16 | This will watch the project directory and restart as necessary. 17 | -------------------------------------------------------------------------------- /components/Button.tsx: -------------------------------------------------------------------------------- 1 | import { JSX } from "preact"; 2 | import { IS_BROWSER } from "$fresh/runtime.ts"; 3 | 4 | export function Button(props: JSX.HTMLAttributes) { 5 | return ( 6 | 12 |

{props.count}

13 | 14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /main.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | 7 | import "$std/dotenv/load.ts"; 8 | 9 | import { start } from "$fresh/server.ts"; 10 | import manifest from "./fresh.gen.ts"; 11 | import config from "./fresh.config.ts"; 12 | 13 | await start(manifest, config); 14 | -------------------------------------------------------------------------------- /routes/_404.tsx: -------------------------------------------------------------------------------- 1 | import { Head } from "$fresh/runtime.ts"; 2 | 3 | export default function Error404() { 4 | return ( 5 | <> 6 | 7 | 404 - Page not found 8 | 9 |
10 |
11 | the Fresh logo: a sliced lemon dripping with juice 18 |

404 - Page not found

19 |

20 | The page you were looking for doesn't exist. 21 |

22 | Go back home 23 |
24 |
25 | 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /routes/_app.tsx: -------------------------------------------------------------------------------- 1 | import { type PageProps } from "$fresh/server.ts"; 2 | export default function App({ Component }: PageProps) { 3 | return ( 4 | 5 | 6 | 7 | 8 | fresh_template 9 | 10 | 11 | 12 | 13 | 14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /routes/api/joke.ts: -------------------------------------------------------------------------------- 1 | import { FreshContext } 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: FreshContext): Response => { 18 | const randomIndex = Math.floor(Math.random() * JOKES.length); 19 | const body = JOKES[randomIndex]; 20 | return new Response(body); 21 | }; 22 | -------------------------------------------------------------------------------- /routes/greet/[name].tsx: -------------------------------------------------------------------------------- 1 | import { PageProps } from "$fresh/server.ts"; 2 | 3 | export default function Greet(props: PageProps) { 4 | return
Hello {props.params.name}
; 5 | } 6 | -------------------------------------------------------------------------------- /routes/index.tsx: -------------------------------------------------------------------------------- 1 | import { useSignal } from "@preact/signals"; 2 | import Counter from "../islands/Counter.tsx"; 3 | 4 | export default function Home() { 5 | const count = useSignal(3); 6 | return ( 7 |
8 |
9 | the Fresh logo: a sliced lemon dripping with juice 16 |

Welcome to Fresh

17 |

18 | Try updating this message in the 19 | ./routes/index.tsx file, and refresh. 20 |

21 | 22 |
23 |
24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/denoland/fresh_template/ac8c2dbbcd25670420af6c4bbd3e6f06a10bd57f/static/favicon.ico -------------------------------------------------------------------------------- /static/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /twind.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig, Preset } from "@twind/core"; 2 | import presetTailwind from "@twind/preset-tailwind"; 3 | import presetAutoprefix from "@twind/preset-autoprefix"; 4 | 5 | export default { 6 | ...defineConfig({ 7 | presets: [presetTailwind() as Preset, presetAutoprefix() as Preset], 8 | }), 9 | selfURL: import.meta.url, 10 | }; 11 | --------------------------------------------------------------------------------