Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강동현
/
nodejs-game
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
강동현
2021-05-23 00:14:56 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31eb5e83f60b018a9a99fd9850cbd293a6417fe9
31eb5e83
1 parent
1d8cb4ce
socket.io 추가
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
server/index.ts
server/package.json
server/yarn.lock
server/index.ts
View file @
31eb5e8
import
express
from
'express'
;
import
socketIo
from
'socket.io'
;
import
{
createServer
}
from
'http'
;
const
PORT
=
3000
;
const
app
=
express
();
const
PORT
=
8008
;
const
server
=
createServer
(
app
);
const
io
=
new
socketIo
.
Server
(
server
);
app
.
get
(
'/'
,
(
req
,
res
)
=>
res
.
send
(
'Express + TypeScript Server'
));
io
.
on
(
'connection'
,
socket
=>
{
console
.
log
(
'Connected.'
);
})
app
.
listen
(
PORT
,
()
=>
{
console
.
log
(
`⚡️[server]: Server is running at http://localhost:
${
PORT
}
`
);
});
server
.
listen
(
PORT
,
()
=>
console
.
log
(
`Listening on
${
PORT
}
`
))
...
...
server/package.json
View file @
31eb5e8
...
...
@@ -2,10 +2,12 @@
"dependencies"
:
{
"@types/express"
:
"^4.17.11"
,
"@types/node"
:
"^15.3.1"
,
"@types/socket.io"
:
"^3.0.2"
,
"express"
:
"^4.17.1"
,
"nodemon"
:
"^2.0.7"
,
"socket.io"
:
"^4.1.2"
,
"ts-node"
:
"^9.1.1"
,
"typescript"
:
"^4.2.4"
,
"express"
:
"^4.17.1"
"typescript"
:
"^4.2.4"
},
"scripts"
:
{
"start"
:
"nodemon index.ts"
...
...
server/yarn.lock
View file @
31eb5e8
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment