managarten/games/arcade/apps/server/src/index.ts
Till JS 6e75718cfa feat(arcade): migrate backend from NestJS to Hono/Bun
Replace @arcade/backend (NestJS) with @arcade/server (Hono/Bun).
Same two endpoints, no auth required (public game generator):
- POST /api/games/generate — AI game generation (Gemini, Claude, GPT)
- POST /api/games/submit  — Community game submission via GitHub PR
- GET  /health            — Health check

This removes the last remaining NestJS backend from the monorepo.
NestJS is now completely gone — all servers use Hono + Bun.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 17:02:14 +02:00

27 lines
807 B
TypeScript

import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { gamesRoutes } from './routes/games';
const PORT = parseInt(process.env.PORT || '3011', 10);
const CORS_ORIGINS = (process.env.CORS_ORIGINS || 'http://localhost:5173').split(',');
const app = new Hono();
app.onError((err, c) => {
console.error('Unhandled error:', err);
return c.json({ error: 'Internal server error' }, 500);
});
app.notFound((c) => c.json({ error: 'Not found' }, 404));
app.use('*', cors({ origin: CORS_ORIGINS, credentials: false }));
app.get('/health', (c) =>
c.json({ status: 'ok', timestamp: new Date().toISOString(), service: 'arcade-server' })
);
app.route('/api/games', gamesRoutes);
console.log(`Arcade server running on http://localhost:${PORT}`);
export default { port: PORT, fetch: app.fetch };