-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathhono.ts
More file actions
29 lines (23 loc) · 868 Bytes
/
Copy pathhono.ts
File metadata and controls
29 lines (23 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @title Hono HTTP server
* @difficulty intermediate
* @tags cli, deploy
* @run -N <url>
* @resource {https://jsr.io/@hono/hono} Hono on jsr.io
* @resource {https://hono.dev/docs} Hono documentation
* @group Network
*
* 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