Skip to content

Commit f3c83de

Browse files
committed
refactor: remove unused components and middleware from fresh example
1 parent e5abdb7 commit f3c83de

6 files changed

Lines changed: 3 additions & 83 deletions

File tree

examples/fresh/components/Button.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/fresh/islands/Counter.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/fresh/main.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ export const app = new App<State>();
77

88
app.use(staticFiles());
99

10-
// Pass a shared value from a middleware
11-
app.use(async (ctx) => {
12-
ctx.state.shared = "hello";
13-
return await ctx.next();
14-
});
15-
16-
// this is the same as the /api/:name route defined via a file. feel free to delete this!
17-
app.get("/api2/:name", (ctx) => {
18-
const name = ctx.params.name;
19-
return new Response(
20-
`Hello, ${name.charAt(0).toUpperCase() + name.slice(1)}!`,
21-
);
22-
});
23-
2410
// Include file-system based routes here
2511
app.fsRoutes();
2612

examples/fresh/routes/_app.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/fresh/routes/api/[name].tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/fresh/routes/index.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
import { useSignal } from "@preact/signals";
21
import { Head } from "fresh/runtime";
32
import { define } from "../utils.ts";
4-
import Counter from "../islands/Counter.tsx";
5-
63
export default define.page(function Home(ctx) {
7-
const count = useSignal(3);
8-
94
console.log("Shared value " + ctx.state.shared);
105

116
return (
@@ -19,14 +14,12 @@ export default define.page(function Home(ctx) {
1914
src="/logo.svg"
2015
width="128"
2116
height="128"
22-
alt="the Fresh logo: a sliced lemon dripping with juice"
17+
alt="the Fedify logo"
2318
/>
24-
<h1 class="text-4xl font-bold">Welcome to Fresh</h1>
19+
<h1 class="text-4xl font-bold">Welcome to Fresh & Fedify</h1>
2520
<p class="my-4">
26-
Try updating this message in the
27-
<code class="mx-2">./routes/index.tsx</code> file, and refresh.
21+
Hello, Fediverse!
2822
</p>
29-
<Counter count={count} />
3023
</div>
3124
</div>
3225
);

0 commit comments

Comments
 (0)