HonoH
Hono11mo ago
sizzF

Why Are My Hono RPC Routes Not Showing Beyond $get, $post, and $url?

I have set up RPC in my Hono project and configured my routes as follows. However, when I check the available RPC methods, only $get, $post, and $url appear in the list.

How can I make all the other defined routes accessible through RPC?

Here is my current router setup:

export const evaluationRoundRouter = new Hono()
  .use('/*', isLoggedIn)
  .get('/', zValidator('query', selectListEvaluationRoundParamsSchema, validationErrorHook), async c => { 
    const path = c.req.path;
    const params = c.req.valid('query');


    const result = await evaluationRoundService.selectList(params);


    const response = ResponseCreator.success(
      ResponseCreator.list(
        result.rows,
        result.count,
        params.offset && Math.floor(params.offset / (params.limit || 10)) + 1,
        params.limit
      ),
      ResponseType.LIST,
      { query: params }
    );
    return c.json(response);
  })
  .get('/id/:id', 
    zValidator('param', selectInfoEvaluationRoundParamsSchema, validationErrorHook), 
    async c => {
      const path = c.req.path;
      const params = c.req.valid('param');


      const result = await evaluationRoundService.selectInfoById(params);


      const response = ResponseCreator.success(
        result,
        ResponseType.INFO,
        { param: params }
      );
      return c.json(response);
    }
  );

const app = new Hono().route('/evaluation/evaluation-round', evaluationRoundRouter);


When I inspect the registered routes using:

app.all().routes.map(v => v.path)


I can see that all routes are correctly registered:

"/evaluation/evaluation-round",
"/evaluation/evaluation-round/id/:id",


Despite this, only $get, $post, and $url appear in the available RPC method list.

How can I make all my defined routes accessible via RPC?
image.png
Was this page helpful?