Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daniel-le97/bun-nano-jsx
https://github.com/daniel-le97/bun-nano-jsx
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/daniel-le97/bun-nano-jsx
- Owner: daniel-le97
- Created: 2023-08-20T22:16:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:39:09.000Z (about 1 year ago)
- Last Synced: 2024-12-09T14:57:45.757Z (about 1 month ago)
- Language: TypeScript
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React SSR
This is a project demonstrating how to build a simple Bun app with server-side rendering React + client-side hydration.
## Getting started
```sh
bun create react-ssr
bun install
bun run dev
```This starts the development server in watch mode. Open http://localhost:3000 in your browser to see the result.
## Learn more
The following files are the most important:
- `dev.tsx`: Generates a browser build of all `pages` using `Bun.build`, then starts a dev server that handles incoming requests. For paths like `/` and `/settings`, the server will render the appropriate page in `pages` to static HTML and return the result. The returned HTML includes a `` tag that imports a bundled version of `hydrate.tsx`.
- `hydrate.tsx`: A script that hydrates the static HTML returned by the server.
- `pages/*.tsx`: A set of pages. Incoming requests are resolved against this directory using Next.js-style routing.