HonoH
Hono14mo ago
.gwapes

Hono not matching routes

Hi, I’m using hono as my backend server, however it’s not matching routes… everything gets passed to my notFound handler.

import { Hono } from "hono";
import { serve } from '@hono/node-server';
export default async function setupServer(client) {
    const app = new Hono();
    app.get("/", async (c) => {
        return c.json({ message: "Gwapes's API: Version 1" }, 200);
    });
    app.notFound(async (c) => {
        console.log(c.req.url);
        return c.json({ message: "Not found" }, 404);
    });
    // const voteApp = voting(client);
    // app.route("/voting", voteApp);
    // app.route("/", userApp);
    serve({
        fetch: (req, env) => {
            console.log(req.url, "logging url");
            req.headers.forEach((val, key) => console.log(key, val));
            return app.fetch(req, env);
        },
        port: 69,
    }, (info) => console.log("Listening on port " + info));
};

I’m using nginx as my proxy to my domain.

This is my conf for this server:
location /v1 {
        proxy_pass http://localhost:69;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;              >
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarde>
        proxy_set_header X-Forwarded-Proto $scheme;           >
    }

However I don’t think this is the problem since the requests to go to my server.

Versions:
  • @hono/node-server : 1.13.2
  • hono : 4.6.5
Thanks in advance
Was this page helpful?