-
글쓴이글
-
2022년 6월 7일 01:49 #35729
YDC참가자쌤 영상보고 잘 따라했는데
405 에러가 떠요
밑에 썜 코드 그대로 넣어도 같은 오류 뜹니다.
새로고침해봐도 똑같네요
페이지가 작동하지 않습니다.
문제가 계속되면 사이트 소유자에게 문의하세요.HTTP ERROR 405
write.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<title>Document</title>
</head>
<body>
<h4 class="container mt-4"><strong>글 작성페이지</strong></h4><div class="container mt-3">
<form action="/add" method="POST">
<div class="form-group">
<label>오늘의 할일</label>
<input type="text" class="form-control" name="title">
</div>
<div class="form-group">
<label>날짜</label>
<input type="text" class="form-control" name="date">
</div>
<button type="submit" class="btn btn-outline-secondary">Submit</button>
</form>
</div><script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>server.js
const express = require('express')
const app = express()
const bodyParser= require('body-parser')
app.use(bodyParser.urlencoded({extended: true}))app.listen(8080, function() {
console.log('listening on 8080')
})app.get('/', function(요청, 응답) {
응답.sendFile(__dirname +'/index.html')
})app.get('/write', function(요청, 응답) {
응답.sendFile(__dirname +'/write.html')
});app.post('/add', function(요청, 응답){
console.log(요청.body);
응답.send('전송완료')
}); -
글쓴이글
- 답변은 로그인 후 가능합니다.