Move server back to index.js

This commit is contained in:
wancat committed 2023-07-15 15:43:13 +08:00
1 parent de637f3cf6
commit 45a0aa6249
5 files changed
+38 -38

No files matched your search

+6 -2
View File
@@ -1,12 +1,16 @@
import express from 'express'
import http from 'http'
import socketServer from './socket.js'
const app = express()
const port = 3000
const app = express()
const server = http.createServer(app)
socketServer(server)
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
server.listen(port, () => {
console.log(`Server listening at http://localhost:${port}`)
})