Hono HTTP server
An example of a HTTP server that uses the Hono framework.
Import the Hono framework
import { Hono } from "jsr:@hono/hono";
Create a new Hono server
const app = new Hono();
Define a route that responds with "Hello, World!" The first argument is the path, the second is the request handler
app.get("/", (c) => c.text("Hello, World!"));
Call Deno.serve with the request handler to start the server on the default port (8000)
Deno.serve(app.fetch);
Test the server with: curl http://localhost:8000 Should output "Hello, World!"
Read more about Hono with Deno at https://hono.dev/docs/getting-started/deno
Run this example locally using the Deno CLI:
deno run --allow-net https://docs.deno.com/examples/hono.ts