Setting up Hello World API
To create a simple Hello World API using Hono.js, follow these steps:
Run the following command to create a new Hono project
bun create hono@latestWhen prompted choose the following options:
✔ Target directory: my-app✔ Which template do you want to use? bun✔ Do you want to install project dependencies? Yes✔ Which package manager do you want to use? bunThis will set up a basic Hono.js project with a Hello World API.
Project Structure
Section titled “Project Structure”Directorysrc
- index.ts API endpoint is hiding here 👀
- .gitignore
- README.md
- bun.lock
- package.json
- tsconfig.json
Running the Application
Section titled “Running the Application”-
Change directory to your project
Terminal window cd my-app -
Start the development server
Terminal window bun run dev
Your app will run at http://localhost:8787.
Open it in your browser, and you will see Hello Hono!