File size: 558 Bytes
52c9d85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()