aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Pooley <zuedev@gmail.com>2025-03-19 05:45:48 +0000
committerAlex Pooley <zuedev@gmail.com>2025-03-19 05:45:48 +0000
commitee8d3549cb9dccc8b7fe839635c0ec3fa30c9109 (patch)
treea3e13d4f26ca6c0c000b740e4e7a059e466c4ff8
parent2d656ad02509d71b8793db5e75715f91f6e7b3fc (diff)
downloadzue.dev-ee8d3549cb9dccc8b7fe839635c0ec3fa30c9109.tar
zue.dev-ee8d3549cb9dccc8b7fe839635c0ec3fa30c9109.tar.gz
zue.dev-ee8d3549cb9dccc8b7fe839635c0ec3fa30c9109.tar.bz2
zue.dev-ee8d3549cb9dccc8b7fe839635c0ec3fa30c9109.tar.xz
zue.dev-ee8d3549cb9dccc8b7fe839635c0ec3fa30c9109.zip
feat: enhance middleware by adding pretty JSON responses and request ID
-rw-r--r--source/index.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/index.js b/source/index.js
index 472f7f1..6dc9ab9 100644
--- a/source/index.js
+++ b/source/index.js
@@ -1,12 +1,20 @@
import { Hono } from "hono";
import { cors } from "hono/cors";
+import { prettyJSON } from "hono/pretty-json";
+import { requestId } from "hono/request-id";
import service_status from "./library/service_status";
const app = new Hono();
// enable cors for all routes
-app.use("*", cors());
+app.use(cors());
+
+// pretty print json responses
+app.use(prettyJSON());
+
+// add a request id to all requests
+app.use(requestId());
// return a simple hello world message
app.get("/", (context) => {