HonoH
Hono14mo ago
wyilio

Adding hono to existing node express project

Does anyone have experience using Hono alongside their Node express server? We're trying to use Express middleware to pass requests to our Hono router

I keep getting a 404 not found and can't figure out how to pass the Express request properly to Hono
      const router = express.Router<$Request, $Response>();
      router.use('/hono', async (req, res, next) => {
        honoApp
          .request(req, {
            raw: res,
            passThrough: next,
          })
          .then(honoResponse => {
            if (!honoResponse) {
              console.log(honoResponse);
              return next();
            } // Pass through if not handled by Hono
          })
          .catch(next);
      });
Was this page helpful?