diff --git a/hono-bun-jsx/README.md b/hono-bun-jsx/README.md new file mode 100644 index 0000000..61a505c --- /dev/null +++ b/hono-bun-jsx/README.md @@ -0,0 +1,28 @@ +# Hono + Bun Basic Client Component Example +This is a simple project that demonstrates how to build a basic Hono app with Bun, including a client-side component rendered using `hono/jsx`. + +## Getting Started +1. **Install Dependencies** + First, make sure you have Bun installed. Then, install the necessary dependencies: + + ```sh + bun install + ``` + +2. **Running the Project** + To start the development server and bundle the client-side code: + + ```sh + bun run dev + ``` + + This will do two things: + - Bundle the client-side code from `src/App.tsx` into `static/App.js`. + - Start the Bun server with hot reloading using `src/index.tsx`. + +3. **Open the App** + Once the server is running, open your browser and navigate to: + [http://localhost:3000](http://localhost:3000) + + You should see a basic app with a counter component that you can increment. + diff --git a/hono-bun-jsx/package.json b/hono-bun-jsx/package.json new file mode 100644 index 0000000..9c5349e --- /dev/null +++ b/hono-bun-jsx/package.json @@ -0,0 +1,12 @@ +{ + "name": "my-app", + "scripts": { + "dev": "bun build src/App.tsx --outdir ./static --outfile App.js && bun run --hot src/index.tsx" + }, + "dependencies": { + "hono": "^4.5.11" + }, + "devDependencies": { + "@types/bun": "latest" + } +} \ No newline at end of file diff --git a/hono-bun-jsx/src/App.tsx b/hono-bun-jsx/src/App.tsx new file mode 100644 index 0000000..26d63f2 --- /dev/null +++ b/hono-bun-jsx/src/App.tsx @@ -0,0 +1,28 @@ +import { FC, useState } from 'hono/jsx'; +import {render} from 'hono/jsx/dom'; + +function Counter() { + const [count, setCount] = useState(0); + return ( +
Count: {count}
+ +