app.post('/chatroom', 로그인했니, function(요청, 응답){
});
상위 내용을 server.js에 저장하고 실행했는데,
function 로그인했니(요청, 응답, next){
console.log('미들웨어확인')
if(요청.user){
next()
} else {
응답.send('로그인안하셨는데요?')
}
}
쿠키를 삭제하고 버튼을 눌러봐도, 콘솔만 실행될뿐
로그인안하셨는데요?라는 페이지는 등장하지 않아서 질문드립니다.
이전까지는 로그인했니가 잘 작동했는데 이유가 뭘까요
참고로 chatroom post의 위치는 강의대로 맨 밑쪽에 넣어두었습니다.
서버 실행시 나오는 오류 코드가 있긴한데, 혹시 도움이 될까 싶어 남깁니다.
(node:34424) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:34424) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
listening on 8080