forked from Github/uno-online
24 lines
511 B
JavaScript
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}`)
|
|
}) |