5 글 보임 - 1 에서 5 까지 (총 5 중에서)
-
글쓴이글
-
2023년 2월 27일 02:31 #70214
김민주참가자아작스로 chatroom으로 서버를 요청하면 콘솔창에 POST http://localhost:8080/chatroom 500 (Internal Server Error) jquery-3.4.1.js:9837 send( options.hasContent && options.data || null );가 에러가 뜹니다. 이유가 무엇일까요? server.js app.post('/chatroom',로그인했니,(req,res)=>{ var save = { title : req.body.당한사람, member : [ObjectId(req.body.당한사람id), req.user._id], date : new Date() } db.collection('chatroom').insertOne(save).then((result)=>{ res.send('저장완료') }); }) (jquery) $('#chat').click(function(e){ var id = e.target.dataset.id; $.post('/chatroom', {당한사람id : id}).then(()=>{ }) });
2023년 2월 28일 03:07 #70343
김민주참가자콘솔로 찍으면 잘 나옵니다 하지만 에러를 보면 이렇게 나옵니다ㅠㅠ <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body>
BSONTypeError: Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer<br> at new BSONTypeError (C:\Users\com_01\Desktop\butterfly\poca\node_modules\bson\lib\error.js:41:28)<br> at new ObjectId (C:\Users\com_01\Desktop\butterfly\poca\node_modules\bson\lib\objectid.js:67:23)<br> at ObjectId (C:\Users\com_01\Desktop\butterfly\poca\node_modules\bson\lib\objectid.js:26:20)<br> at C:\Users\com_01\Desktop\butterfly\poca\server.js:434:19<br> at Layer.handle [as handle_request] (C:\Users\com_01\Desktop\butterfly\poca\node_modules\express\lib\router\layer.js:95:5)<br> at next (C:\Users\com_01\Desktop\butterfly\poca\node_modules\express\lib\router\route.js:144:13)<br> at 로그인했니 (C:\Users\com_01\Desktop\butterfly\poca\server.js:139:1)<br> at Layer.handle [as handle_request] (C:\Users\com_01\Desktop\butterfly\poca\node_modules\express\lib\router\layer.js:95:5)<br> at next (C:\Users\com_01\Desktop\butterfly\poca\node_modules\express\lib\router\route.js:144:13)<br> at Route.dispatch (C:\Users\com_01\Desktop\butterfly\poca\node_modules\express\lib\router\route.js:114:3)
</body>
</html> -
글쓴이글
5 글 보임 - 1 에서 5 까지 (총 5 중에서)
- 답변은 로그인 후 가능합니다.