marcos daniel
marcos daniel9mo ago

can't call nested route

this is the top level router:
const appRouter = router({
hello: procedure.query(() => 'hello world'),
chess: chessRouter,
});
const appRouter = router({
hello: procedure.query(() => 'hello world'),
chess: chessRouter,
});
the chess router being something along these lines:
export const chessRouter = router({
login: procedure.mutation(async (opts) => {
//...
}),
});
export const chessRouter = router({
login: procedure.mutation(async (opts) => {
//...
}),
});
if I run the curl command like this it won't find the nested "login" mutation, although it works for top level "hello" curl -X POST "http://localhost:6002/chess/login" {"error":{"message":"No \"query\"-procedure on path \"chess/login/\"","code":-32004,"data":{"code":"NOT_FOUND","httpStatus":404,"stack":"TRPCError: No \"query\"-procedure on path \"chess/login/\"
2 Replies
Nick
Nick9mo ago
routers are separated by a . not a /
marcos daniel
marcos daniel9mo ago
wow thanks I just spent half a day furiously researching this