Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

🌐 Multi-Route Website with Hono

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* This val creates a simple website for Janic Business Group, a business consulting firm.
* It uses React for the frontend and Hono for the backend routing.
* The website includes a home page, about page, and services page.
*/
/** @jsxImportSource https://esm.sh/react */
import React from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Hono } from "https://esm.sh/hono";
import { jsx } from "https://esm.sh/hono/jsx";
const app = new Hono();
function App() {
const [page, setPage] = React.useState('home');
const renderPage = () => {
switch(page) {
case 'home':
return <HomePage />;
case 'about':
return <AboutPage />;
case 'services':
return <ServicesPage />;
default:
return <HomePage />;
}
}
return (
<div>
<header>
<h1>Janic Business Group</h1>
<nav>
<button onClick={() => setPage('home')}>Home</button>
<button onClick={() => setPage('about')}>About</button>
<button onClick={() => setPage('services')}>Services</button>
</nav>
</header>
<main>
{renderPage()}
</main>
<footer>
<p>Β© 2023 Janic Business Group. All rights reserved.</p>
<p>
<a href={import.meta.url.replace("esm.town", "val.town")} target="_blank" rel="noopener noreferrer">
View Source
</a>
</p>
</footer>
</div>
);
}
function HomePage() {
return (
<div>
<h2>Welcome to Janic Business Group</h2>
<p>We are your trusted partner in business consulting. With years of experience and a team of experts, we help businesses grow, optimize operations, and achieve their goals.</p>
</div>
);
}
function AboutPage() {
return (
<div>
<h2>About Us</h2>
<p>Janic Business Group was founded in 2005 with a mission to empower businesses through strategic consulting. Our team of seasoned professionals brings diverse expertise to tackle complex business challenges.</p>
</div>
);
}
function ServicesPage() {
return (
<div>
<h2>Our Services</h2>
<ul>
<li>Strategic Planning</li>
<li>Financial Analysis</li>
<li>Market Research</li>
<li>Operational Efficiency</li>
<li>Leadership Development</li>
</ul>
</div>
);
}
function client() {
createRoot(document.getElementById("root")).render(<App />);
}
if (typeof document !== "undefined") { client(); }
app.get('*', (c) => {
return c.html(
jsx(
<html>
<head>
<title>Janic Business Group</title>
<style>{css}</style>
</head>
cofsana-multiroutehono.web.val.run
August 25, 2024