Posted on

Make a message in speak place (/:roomId/message) [POST request]

Make a message in speak place (/:roomId/message) [POST request] Something to notice let me reveal userIds, type comes from req.body while userId that will be getting aliased as chatInitiatorId is coming from req due to all of our decode middleware. Should you remember, we affixed app.use("/room", decode, chatRoomRouter); within server/index.js document. This implies this course /room/initiate are authenticated. So const < userId:>= req; may be the id associated with the current user logged in. We just call all of our initiateChat method from ChatRoomModel and move they allUserIds, type, chatInitiator . Whatever consequences will come we simply go they for…