Files
botfights/server/src/index.ts
T

19 lines
599 B
TypeScript
Raw Normal View History

import { serve } from '@hono/node-server'
import { app } from './app.js'
import { runMigrations } from './db/startup.js'
import { seedMockBots } from './engine/mock.js'
import { startBackgroundFights } from './engine/background.js'
// Run migrations and seed mock bots before starting the server
runMigrations()
await seedMockBots()
const port = Number(process.env.PORT) || 9100
serve({ fetch: app.fetch, port }, () => {
console.log(`[botfights] server listening on http://localhost:${port}`)
// Start background fight loop so the site always has fresh activity
startBackgroundFights()
})