Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 0206f9d

Browse files
author
ije
committed
chore(example): restore hello example
1 parent bf88a39 commit 0206f9d

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

examples/hello-world/api/hi.ts

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

examples/hello-world/pages/index.tsx

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
import { Import, useDeno } from 'https://deno.land/x/aleph/mod.ts'
22
import React, { useState } from 'https://esm.sh/react'
33
import Logo from '../components/logo.tsx'
4-
import useSWR from "https://esm.sh/swr"
5-
import Axios from "https://esm.sh/axios";
6-
7-
const fetcher = (url: string) => Axios.get(url).then(({ data }) => data);
84

95
export default function Home() {
10-
const { data } = useSWR('/api/hi', fetcher);
6+
const [count, setCount] = useState(0)
7+
const version = useDeno(() => {
8+
return Deno.version
9+
})
1110

12-
if (!data) {
13-
return <div>loading...</div>
14-
}
15-
return <div>hello {data.name}!</div>
11+
return (
12+
<div className="page">
13+
<Import from="../style/index.less" />
14+
<p className="logo"><Logo /></p>
15+
<h1>Welcome to use <strong>Aleph.js</strong>!</h1>
16+
<p className="links">
17+
<a href="https://alephjs.org" target="_blank">Website</a>
18+
<span>&middot;</span>
19+
<a href="https://alephjs.org/docs/get-started" target="_blank">Get Started</a>
20+
<span>&middot;</span>
21+
<a href="https://alephjs.org/docs" target="_blank">Docs</a>
22+
<span>&middot;</span>
23+
<a href="https://github.com/alephjs/aleph.js" target="_blank">Github</a>
24+
</p>
25+
<p className="counter">
26+
<span>Counter:</span>
27+
<strong>{count}</strong>
28+
<button onClick={() => setCount(n => n - 1)}>-</button>
29+
<button onClick={() => setCount(n => n + 1)}>+</button>
30+
</p>
31+
<p className="copyinfo">Built by Aleph.js in Deno v{version.deno}</p>
32+
</div>
33+
)
1634
}

0 commit comments

Comments
 (0)