Files
AIHostingTycoon/apps/server/src/index.ts
T
josh 68540ebcf9
CI / build-and-push (push) Successful in 1m10s
Add Docker and Gitea Actions CI/CD pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:27:07 -04:00

31 lines
986 B
TypeScript

import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { logger } from 'hono/logger';
import { serve } from '@hono/node-server';
import { auth } from './routes/auth';
import { savesRouter } from './routes/saves';
import { leaderboardRouter } from './routes/leaderboard';
const app = new Hono();
app.use('*', logger());
app.use('*', cors({
origin: process.env.CORS_ORIGIN
? process.env.CORS_ORIGIN.split(',')
: ['http://localhost:5173', 'http://localhost:5174', 'http://localhost:5175', 'http://localhost:5178'],
allowMethods: ['GET', 'POST', 'PUT', 'DELETE'],
allowHeaders: ['Content-Type', 'Authorization'],
}));
app.get('/health', (c) => c.json({ status: 'ok', version: '0.1.0' }));
app.route('/api/auth', auth);
app.route('/api/saves', savesRouter);
app.route('/api/leaderboard', leaderboardRouter);
const port = Number(process.env.PORT) || 3001;
console.log(`AI Tycoon API server starting on port ${port}...`);
serve({ fetch: app.fetch, port });