app.post('/add', (req, res) => { // 화살표 함수
res.send('전송완료');
console.log(req)
})
req: 요청 정보를 담고있음.
console을 찍어보면 너무 방대한 양의 정보가 있다.
npm install body-parser
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({extended : true})) // 미들웨어
app.post('/add', (req, res) => { // 화살표 함수
console.log(req.body.title)
res.send('전송완료');
})
...
<h2 class="container mt-4"><strong>글 작성 페이지</strong></h2>
<div class="container mt-3">
<form action="/add" method="post">
<div class="form-group">
<label>오늘의 할일</label>
<input type="text" name="title" class="form-control">
</div>
<div class="form-group">
<label>날짜</label>
<input type="text" name="date" class="form-control">
</div><p></p>
<button type="submit" class="btn btn-outline-danger">저장</button>
</form>
</div>
...
application programming interface
관계형 데이터베이스 : 오라클, mysql, mssql, postgreSQL
NoSQL : mongoDB
Create
Read
Update
Delete