alex
alex
TtRPC
Created by alex on 6/7/2024 in #❓-help
nodeHTTPHandler with Nitro
Nvm, it seems to work like this. Have to return the correct response of course (which revealed another error with the path).
export default defineEventHandler(async (event) => {
console.log('trpc route handler');
const res = await nodeHTTPRequestHandler({
req: event.node.req,
res: event.node.res,
router: appRouter,
path: getRequestURL(event).pathname.replace('/api/trpc/', ''),
});
return event.node.res;
});
export default defineEventHandler(async (event) => {
console.log('trpc route handler');
const res = await nodeHTTPRequestHandler({
req: event.node.req,
res: event.node.res,
router: appRouter,
path: getRequestURL(event).pathname.replace('/api/trpc/', ''),
});
return event.node.res;
});
No need for trpc-nuxt :POGGIES:
3 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
All the hoops we have to jump through just to make stuff work because of that rule :(
19 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
:o really?
19 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
Ah I see, that makes sense. Thank you!
19 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
I guess that would be on the react-query side then, not on trpc.
19 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
I'm not a typescript wizard yet but would it - just theoretically - be possible to infer that userId is not null from the enabled option?
19 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
Fair enough, going to use that for now, thanks!
19 replies
TtRPC
Created by alex on 12/21/2022 in #❓-help
Type safety with enabled option
That's also one thought I had, but couldn't bring myself to implement it, just felt too wrong :D
19 replies