uno-online/server.js
2021-02-22 05:29:23 +05:30

24 lines
511 B
JavaScript

const express = require('express')
const socketio = require('socket.io')
const http = require('http')
const cors = require('cors')
const PORT = process.env.PORT || 5000
const app = express()
const server = http.createServer(app)
const io = socketio(server)
app.use(cors())
io.on('connection', socket => {
console.log('connection made')
socket.on('disconnect', () => {
console.log('connection lost')
})
})
server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`)
})