import "dotenv/config"; import { Context, Hono } from "hono"; import { serve } from "@hono/node-server"; import { showRoutes } from "hono/dev"; import { cors } from "hono/cors"; const app = new Hono(); app.use(cors()); app.get("/", (c: Context) => { return c.text("Hello Hono!"); }); app.notFound((c) => { const errorMessage = `[Error] 404 - Route Not Found ([${c.req.method}] ${c.req.path})` return c.json({ message: errorMessage, ok: false, }, 404); }); const PORT = process.env.PORT ? +process.env.PORT : 8181; showRoutes(app, { verbose: process.env.NODE_ENV === "development", colorize: true, }); console.log(`Server is running on port http://localhost:${PORT}`); serve({ fetch: app.fetch, port: PORT, });