데이터파싱1 [nodeJS] body-parser로 JSON 파싱하기 1. body-parser HTTP 요청의 본문(body)을 쉽게 파싱하도록 도와주는 미들웨어 req.body는 body-parser를 사용하기 전에는 디폴트 값으로 Undefined이 설정되서 그냥 사용 시 에러 발생 요청 데이터를 서버에서 처리하기 쉽도록 데이터 포맷 지원 JSON (application/json) URL-encoded (application/x-www-form-urlencoded) Raw (application/octet-stream) Text (text/plain) 2. 사용 방법 npm install body-parser const express = require('express'); const bodyParser = require('body-parser'); const app .. 2023. 6. 17. 이전 1 다음