Skip to content
Snippets Groups Projects
Commit 21111b59 authored by Moreau Elise's avatar Moreau Elise
Browse files

[api][messages routes] remove mongoose & send user instead of his id

parent 3070f5c9
No related branches found
No related tags found
No related merge requests found
import express from 'express';
import mongoose from "mongoose";
const router = express.Router();
import Room from "../models/Room.js";
......@@ -35,7 +34,7 @@ router.post('/', validator.body(messageSchema), async function(req, res, next){
const newMessage = new Message({
body: req.body.body,
author : author._id,
author: author,
room: room._id,
date: new Date()
});
......@@ -46,10 +45,6 @@ router.post('/', validator.body(messageSchema), async function(req, res, next){
return next(err);
}
// websockets.forEach(function (otherWS) {
// otherWS.send(JSON.stringify(msg))
// });
res.json(newMessage);
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment