Add api-server and CLI applications
- Create api-server with Bun.serve: - oRPC router with stub handlers for all procedures - Auth middleware placeholder - CORS configuration - Create CLI tool with stricli: - bootstrap command for initial superuser creation - Placeholder commands for auth, user, org management Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
22
apps/api-server/src/index.ts
Normal file
22
apps/api-server/src/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { RPCHandler } from "@orpc/server/fetch";
|
||||
import { router } from "./router.js";
|
||||
|
||||
const handler = new RPCHandler(router);
|
||||
|
||||
Bun.serve({
|
||||
port: process.env.PORT || 3001,
|
||||
async fetch(request) {
|
||||
const url = new URL(request.url);
|
||||
|
||||
if (url.pathname.startsWith("/api/v1/rpc")) {
|
||||
const { response } = await handler.handle(request, {
|
||||
prefix: "/api/v1/rpc",
|
||||
});
|
||||
return response ?? new Response("Not Found", { status: 404 });
|
||||
}
|
||||
|
||||
return new Response("Not Found", { status: 404 });
|
||||
},
|
||||
});
|
||||
|
||||
console.log("API server running on port", process.env.PORT || 3001);
|
||||
Reference in New Issue
Block a user