Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
7b2efa8f
Commit
7b2efa8f
authored
Jan 26, 2021
by
Soo Hyun Kim
Browse files
0126머지후
parents
650999ad
108b1b94
Changes
23
Hide whitespace changes
Inline
Side-by-side
server/routes/user.routes.js
View file @
7b2efa8f
...
...
@@ -7,10 +7,14 @@ const router = express.Router()
router
.
route
(
'
/users/signup
'
)
.
post
(
userCtrl
.
signup
)
router
.
route
(
'
/users/check
'
)
.
get
(
userCtrl
.
checkUser
)
router
.
route
(
`/users/:userId`
)
.
get
(
userCtrl
.
getProfile
)
.
put
(
userCtrl
.
profileUpload
,
userCtrl
.
update
)
router
.
param
(
'
userId
'
,
userCtrl
.
userById
)
...
...
server/server.js
View file @
7b2efa8f
...
...
@@ -33,13 +33,7 @@ io.on("connection", (socket) => { // 기본 연결
let
roomInfo
=
data
;
socket
.
leave
(
roomInfo
);
//클라이언트에서 data에 적힌 room정보를 브로드캐스팅 받지 않는다.
});
socket
.
on
(
'
newUser
'
,
(
data
)
=>
{
console
.
log
(
'
newUser
'
,
data
)
let
userInfo
=
data
.
userInfo
;
io
.
to
(
data
.
rmIf
).
emit
(
'
sendUser
'
,
userInfo
)
})
socket
.
on
(
'
chat
'
,
async
(
data
)
=>
{
console
.
log
(
'
roomname확인
'
,
data
)
const
room
=
await
Room
.
findOne
({
roomId
:
data
.
roomInfo
})
...
...
@@ -48,13 +42,14 @@ io.on("connection", (socket) => { // 기본 연결
const
chat
=
await
new
Chat
({
room
:
room
.
_id
,
username
:
data
.
sendInfo
.
sender
,
message
:
data
.
sendInfo
.
msg
message
:
data
.
sendInfo
.
msg
,
profileimg
:
data
.
sendInfo
.
img
}).
save
()
console
.
log
(
'
resChat확인
'
,
chat
)
socket
.
broadcast
.
to
(
data
.
roomInfo
).
emit
(
'
sendedMSG
'
,
data
.
sendInfo
);
// sender 제외 특정 방으로
});
});
socket
.
on
(
'
disconnect
'
,
()
=>
{
console
.
log
(
'
disconnected from server id=
'
,
socket
.
id
)
...
...
@@ -75,4 +70,4 @@ server.listen(3030, () => {
})
export
default
server
// module.exports = server;
// module.exports = server;
\ No newline at end of file
uploads/19877e6cdeb6d21139ee57df54bc0ddd
0 → 100644
View file @
7b2efa8f
File added
Prev
1
2
Next
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