|
import Fastify from 'fastify'
|
|
import { Server } from 'socket.io'
|
|
import { PrismaClient } from '@prisma/client'
|
|
|
|
const fastify = Fastify({ logger: true })
|
|
const io = new Server(fastify.server)
|
|
const prisma = new PrismaClient()
|
|
|
|
fastify.get('/', async () => {
|
|
return { status: 'ok' }
|
|
})
|
|
|
|
io.on('connection', (socket) => {
|
|
console.log('Client connected')
|
|
})
|
|
|
|
const start = async () => {
|
|
try {
|
|
await fastify.listen({ port: 7860, host: '0.0.0.0' })
|
|
} catch (err) {
|
|
fastify.log.error(err)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
start() |