├── static ├── favicon.ico └── logo.svg ├── .vscode ├── extensions.json └── settings.json ├── twind.config.ts ├── dev.ts ├── routes ├── [name].tsx ├── index.tsx └── api │ └── joke.ts ├── README.md ├── deno.json ├── components └── Button.tsx ├── main.ts ├── import_map.json ├── islands └── Counter.tsx └── fresh.gen.ts /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midudev/campanadas.dev/main/static/favicon.ico -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "denoland.vscode-deno", 4 | "sastan.twind-intellisense" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.lint": true, 4 | "editor.defaultFormatter": "denoland.vscode-deno" 5 | } 6 | -------------------------------------------------------------------------------- /twind.config.ts: -------------------------------------------------------------------------------- 1 | import { Options } from "$fresh/plugins/twind.ts"; 2 | 3 | export default { 4 | selfURL: import.meta.url, 5 | } as Options; 6 | -------------------------------------------------------------------------------- /dev.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S deno run -A --watch=static/,routes/ 2 | 3 | import dev from "$fresh/dev.ts"; 4 | 5 | await dev(import.meta.url, "./main.ts"); 6 | -------------------------------------------------------------------------------- /routes/[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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fresh project 2 | 3 | ### Usage 4 | 5 | Start the project: 6 | 7 | ``` 8 | deno task start 9 | ``` 10 | 11 | This will watch the project directory and restart as necessary. 12 | -------------------------------------------------------------------------------- /deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": { 3 | "start": "deno run -A --watch=static/,routes/ dev.ts" 4 | }, 5 | "importMap": "./import_map.json", 6 | "compilerOptions": { 7 | "jsx": "react-jsx", 8 | "jsxImportSource": "preact" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /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 | 14 | 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /routes/index.tsx: -------------------------------------------------------------------------------- 1 | import { Head } from "$fresh/runtime.ts"; 2 | import Counter from "../islands/Counter.tsx"; 3 | 4 | export default function Home() { 5 | return ( 6 | <> 7 | 8 | Fresh App 9 | 10 |
11 | the fresh logo: a sliced lemon dripping with juice 16 |

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 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------