Skip to main content

Command Palette

Search for a command to run...

A Little About Hono

Updated
2 min read
A Little About Hono

What’s Hono?

Hono is a small and fast web framework for building APIs and web apps in JavaScript and TypeScript. It is lightweight, modern, and works across different runtimes like Node.js, Bun, and Deno.

_____________________________________________________________________________________________________

Let’s Try With Me !!

_____________________________________________________________________________________________________

Setup

  1. Open Git Bash and go to your project folder.

  2. initialize npm.

  3. open package.json with nano and add ‘ ”type” : “module”, ‘ inside. This makes npm work with Hono or other modules that use ES modules.

    Use nano to edit a file, or create one if it doesn’t exist.

  4. and install hono.

    and don’t forget from install @hono/node-server.

    if you don’t install this, you will get an error when running the file later, like this

_____________________________________________________________________________________________________

Create File

  1. create a file named service.js (you can use nano or any editor)

_____________________________________________________________________________________________________

Run the server

  1. write this code inside file server.js

    Save and exit with Ctrl + X, then press Y, then Enter.

  2. Run the code with node server.js

_____________________________________________________________________________________________________

Routes Result

_____________________________________________________________________________________________________

Closing

And that’s it! 🎉

Now you’ve got a simple Hono server running.

Later you can try middleware, auth, or even deploy it.

Thanks for reading! Stay tuned on my blog for more articles or the next episode.

_____________________________________________________________________________________________________

note: picture from https://dev.to/joodi/honojs-a-lightweight-framework-with-big-potential-3lh9

More from this blog

The Digital Alchemist's Log

21 posts