import Fastify from 'fastify'; import { API_PORT } from './config.js'; import { getDb } from './db/index.js'; import { gamedataRoutes } from './routes/gamedata.js'; import { itemRoutes } from './routes/items.js'; import { marketRoutes } from './routes/market.js'; import { economyRoutes } from './routes/economy.js'; import { profileRoutes } from './routes/profiles.js'; import { travelRoutes } from './routes/travel.js'; const app = Fastify({ logger: { level: 'info' } }); getDb(); // initialize schema on startup app.get('/api/health', async () => ({ ok: true })); await app.register(gamedataRoutes); await app.register(itemRoutes); await app.register(marketRoutes); await app.register(economyRoutes); await app.register(profileRoutes); await app.register(travelRoutes); await app.listen({ port: API_PORT, host: '127.0.0.1' }); console.log(`API listening on http://127.0.0.1:${API_PORT}`);