일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 숙제
- JWT
- 3주차
- Get
- 웹 스크래핑(크롤링)
- Sequelize
- SQL
- node winston
- post
- 4주차
- cors
- 부트스트랩
- 5주차
- db
- 1주차
- 비동기
- 위키백과
- 항해99
- MongoDB
- 노드 윈스턴
- 개발일지
- OpenAPI
- 스파르타코딩클럽
- HTTPS
- Transaction
- Node.js
- 2주차
- 트랜잭션
- nginx
- NoSQL
Archives
- Today
- Total
얼음꽃의 일지
[JS] superagent 사용법 본문
728x90
간단한 superagent 사용법 입니다.
Axios 보다는 이걸 사용하고있습니다.
npm install superagent
const superagent = await require('superagent');
const a = await superagent.get('주소')
.set('header', '정보')
.query({쿼리 정보})
const a = await superagent.post('주소')
.set('header', '정보') // content-type, authorization 등등
.send({보낼 정보})
이런 형식으로 바로 잡아서 사용 할 수 있습니다.
어떤면으로 보면 작성할 수 있는 부분이 간결하고 쉽더군요.
추가 내용들은 다음을 참조 하시면 됩니다.
https://www.npmjs.com/package/superagent
728x90
'잡다한 지식' 카테고리의 다른 글
[JS] Sequelize Association(관계) 설정 (0) | 2023.11.08 |
---|---|
[JS] toss 빌링키 연결 및 사용 api (1) | 2023.11.06 |
[JS] api 만들었을때 오래걸리는 현상 확인법 (0) | 2023.11.02 |
[JS] sequelize transaction commit, rollback 잘못 걸었을때 (0) | 2023.11.01 |
[JS] sequelize findAndCountAll 의 활용성 (1) | 2023.10.31 |