T
Join ServertRPC
❓-help
cant access trpc endpoints via the browser
i'm converting some express endpoints to trpc, and I cant figure out how to access my endpoints via the browser for example http://localhost:3000/trpc/getbytenantid
my trpc endpoint
i get my data in the frontend no problem.
my express endpoint
express adapter
my trpc endpoint
export const ticketServiceRouter = router({
getByTenantId: ticketServiceProcedure.query(async () => {
const repo = createRepo();
const tenantId = '908e2d94-aef7-4ba6-a1a3-2ccec65a1d97';
return await repo.get_by_tenant_id({ tenantId });
}),
});
i get my data in the frontend no problem.
const tickets = trpc.ticketService.getByTenantId.useQuery();
my express endpoint
export const create = (router: Router) => {
const repo = createRepo();
router.get('/tickets/get_by_tenant_id', async (req, res) => {
// Mocked. Should be extracted from the JWT.
const tenantId = '908e2d94-aef7-4ba6-a1a3-2ccec65a1d97';
const result = await repo.get_by_tenant_id({ tenantId });
res.json(result);
});
express adapter
app.use(
'/getTenantById',
trpcExpress.createExpressMiddleware({
router: ticketServiceRouter,
createContext,
})
);
Message Not Public
Sign In & Join Server To View
So with this can i access my trpc endpoints on different webisite by making and api request?
Message Not Public
Sign In & Join Server To View
that is what i want , thank you man , one more question do you have any example of trpc-openapi prisma example ?😅
Message Not Public
Sign In & Join Server To View