Skip to content

Commit 4b535c8

Browse files
committed
set up socket to client side
1 parent 99a1a71 commit 4b535c8

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

api/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
import express from "express";
33
import {Server} from "socket.io";
44
import {createServer} from "http";
5+
import cors from 'cors';
56

67
const app = express();
78
const server = createServer(app);
89
const io = new Server(server);
910
const PORT = 8080;
1011

12+
app.use(cors({origin: '*'}))
13+
1114
app.get('/', (req, res)=>{
1215
console.log('running')
1316
})

api/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"author": "",
1313
"license": "ISC",
1414
"dependencies": {
15+
"cors": "^2.8.5",
1516
"express": "^4.18.3",
1617
"nodemon": "^3.1.0",
1718
"socket.io": "^4.7.4"

0 commit comments

Comments
 (0)