This project is a starter template for building a server-client application using Hono Rpc and TypeScript. It includes a basic setup for serving and consuming a REST API.
- src/app.ts: Defines the main application using Hono.
- src/index.ts: Sets up the server using Hono and defines the routes.
- src/routes: Contains the route definitions for handling requests.
- src/client.ts: Provides a client setup for consuming the API endpoints.
- tsconfig.json: TypeScript configuration file.
- package.json: Project dependencies and scripts.
- Node.js (v14 or later)
- npm or pnpm
-
Clone the repository:
git clone https://github.com/yourusername/hono-rpc-starter.git
-
Navigate to the project directory:
cd hono-rpc-starter
-
Install the dependencies:
pnpm install
-
Start the server:
pnpm server
The server will start on
http://localhost:3000
. -
Start the client:
pnpm client
To build the project for production, run:
pnpm build
This will compile the TypeScript files into JavaScript in the dist
directory.
- GET /: Returns a simple "Hello Hono!" message.
- GET /user/me: Fetches user data.
- GET /posts/all: Fetches all posts.
- GET /posts/id:slug: Fetches a specific post by slug.
This project is licensed under the MIT License.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project uses the Hono framework and the Zod validation library.