project-knedita/src/server.ts

17 lines
436 B
TypeScript

import app from './app'
import { createServer } from 'http'
import logger from 'helpers/logger'
import createSocketIOInstance from './socket'
const server = createServer(app)
const io = createSocketIOInstance(server)
app.use((req, res, next) => {
// @ts-expect-error TODO: add io type
req.io = io
next()
})
server.listen(process.env.SERVER_PORT, () => {
logger.info(`Server is running @ ${process.env.SERVER_PORT ?? ''}`)
})