그날 알았지 이럴 줄
[Node js] ERR_HTTP_HEADERS_SENT('set'); 오류 본문
ERR_HTTP_HEADERS_SENT('set');
req와 res는 항상 1:1 이어야하는데, response 응답을 두번 보내서 그렇다.
전 코드
router.get('/logout', isLoggedIn, (req, res) => {
req.session.destroy(function(err){
if(err) throw err;
console.log('세션 삭제, 로그아웃 완료');
res.redirect('/');
});
});
바뀐 코드
router.get('/logout', isLoggedIn, (req, res) => {
req.session.destroy(function(err){
if(err) throw err;
console.log('세션 삭제, 로그아웃 완료');
res.redirect('/');
});
//res.redirect('/');
});
왜 res를 두번 썼지.. 바보인듯
'CODING > Node.js' 카테고리의 다른 글
[Eclipse] gradle.build failed - excution failed fot tast ':compileJava'. (0) | 2023.01.08 |
---|---|
[Node.js] npm start(npm run start) 오류 (0) | 2022.12.02 |
Comments