Project created from basic template
This commit is contained in:
21
src/server/routes/rpc.ts
Normal file
21
src/server/routes/rpc.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { RPCHandler } from "@orpc/server/fetch";
|
||||
|
||||
import { router } from "@/server/rpc";
|
||||
import { Hono } from "hono";
|
||||
|
||||
export const rpcApp = new Hono();
|
||||
|
||||
const handler = new RPCHandler(router);
|
||||
|
||||
rpcApp.use("/*", async (c, next) => {
|
||||
const { matched, response } = await handler.handle(c.req.raw, {
|
||||
prefix: "/rpc",
|
||||
});
|
||||
|
||||
if (matched) {
|
||||
return c.newResponse(response.body, response);
|
||||
}
|
||||
|
||||
await next();
|
||||
return;
|
||||
});
|
Reference in New Issue
Block a user