mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-19 00:41:24 +02:00
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>
27 lines
807 B
TypeScript
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 };
|