Files
sorvor-back/src/playgroud.ts
2024-05-16 17:12:19 +07:00

25 lines
576 B
TypeScript

import express from "express";
import { expressHandler } from "trpc-playground/handlers/express";
import { AppRouter } from "./app";
import { Config } from "./config";
export const runPlayground = async (appRouter: AppRouter) => {
const app = express();
const trpcApiEndpoint = Config.api_url;
const playgroundEndpoint = "/";
app.use(
playgroundEndpoint,
await expressHandler({
trpcApiEndpoint,
playgroundEndpoint,
router: appRouter,
}),
);
app.listen(3001, () => {
console.log("listening at http://localhost:3001");
});
};