Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-server-flip-jump
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Gia Vương
game-server-flip-jump
Commits
ce1d7942
Commit
ce1d7942
authored
Aug 22, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
done
parent
e616675e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
40 deletions
+4
-40
index.js
dist/index.js
+2
-19
index.ts
src/index.ts
+2
-21
No files found.
dist/index.js
View file @
ce1d7942
...
...
@@ -10,27 +10,10 @@ const socket_1 = require("./socket");
const
PORT
=
3001
;
const
server
=
http_1
.
default
.
createServer
(
server_1
.
default
);
const
io
=
new
socket_io_1
.
Server
(
server
,
{
path
:
'/socket'
,
path
:
'/socket
/socket.io
'
,
cors
:
{
methods
:
[
"GET"
,
"POST"
],
origin
:
[
"https://play.gamee.vn"
,
"https://dev.gamee.vn"
,
"http://localhost:7456"
]
// origin: (origin, callback) => {
// const allowed = [
// "https://play.gamee.vn",
// "https://dev.gamee.vn",
// "http://localhost:7456"
// ];
// if (!origin || allowed.includes(origin)) {
// callback(null, origin);
// } else {
// callback(new Error("Not allowed by CORS"));
// }
// },
// credentials: true,
origin
:
"*"
}
});
(
0
,
socket_1
.
setupSocket
)(
io
);
...
...
src/index.ts
View file @
ce1d7942
...
...
@@ -7,32 +7,13 @@ const PORT = 3001;
const
server
=
http
.
createServer
(
app
);
const
io
=
new
Server
(
server
,
{
path
:
'/socket'
,
path
:
'/socket
/socket.io
'
,
cors
:
{
methods
:
[
"GET"
,
"POST"
],
origin
:[
"https://play.gamee.vn"
,
"https://dev.gamee.vn"
,
"http://localhost:7456"
]
// origin: (origin, callback) => {
// const allowed = [
// "https://play.gamee.vn",
// "https://dev.gamee.vn",
// "http://localhost:7456"
// ];
// if (!origin || allowed.includes(origin)) {
// callback(null, origin);
// } else {
// callback(new Error("Not allowed by CORS"));
// }
// },
// credentials: true,
origin
:
"*"
}
});
setupSocket
(
io
);
server
.
listen
(
PORT
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment