From ee8d3549cb9dccc8b7fe839635c0ec3fa30c9109 Mon Sep 17 00:00:00 2001 From: Alex Pooley Date: Wed, 19 Mar 2025 05:45:48 +0000 Subject: feat: enhance middleware by adding pretty JSON responses and request ID --- source/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/index.js') 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) => { -- cgit v1.2.3