아래 코드를 실행시 화면에서는 오류가 없긴한데, server 콘솔에서는 오류가 출력됩니다.
<화면>
<실행한 코드>
<콘솔창 내용>
{ _id: 32, title: 'asdf', date: 'ㅠㄹㅊㅇㅎasdfasdf' }
null
TypeError: ~/views/detail.ejs:27
25| <div class="card" style="width: 100%">
26| <div class="card-body">
>> 27| <h5 class="card-title"><%= data.title %></h5>
28| <h6 class="card-subtitle mb-2 text-muted"><%= data.date %></h6>
29| <p class="card-text">임시내용입니다.</p>
30| " class="card-link">수정하기
Cannot read properties of null (reading 'title')
<질문>
data가 null이라고 떠서 console.log를 해봤더니, 값이 있었다가 null로 출력되는 것을 확인했습니다.
console.log가 왜 두번 출력되는지도, 왜 null로 출력되는지도 잘 모르겠습니다 ㅠㅠ 답변 주시면 감사하겠습니다.