Edit.ejs
<div class="container mt-3">
<form action="/add?_method=PUT" method="POST">
<div class="form-group">
<label>할일</label>
<input type="text" name="id" value="<%= post._id %>" style="display: none;">
<input type="text" value="<%= post.제목 %>" class="form-control" name="title">
</div>
<div class="form-group">
<label>날짜</label>
<input type="text" value ="<%= post.날짜 %> "class="form-control" name="date">
</div>
<button type="submit" class="btn btn-outline-secondary">수정</button>
</form>
</div>
server.js
app.put('/edit', function(요청, 결과){
db.collection('post').updateOne( {_id : parseInt(요청.body.id) }, {$set : { 제목 : 요청.body.title , 날짜 : 요청.body.date }},
function(){
console.log('수정완료')
응답.redirect('/list')
});
});
했는데
Cannot PUT /add 가 뜨네요
제가 기존에 작성한게 똑같이 이렇게 떠서서 선생님이 작성하신거 복붙했는데 이렇게 뜹니다..