잡다한 지식
[JS] superagent 사용법
얼음꽃
2023. 11. 3. 14:57
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
superagent
elegant & feature rich browser / node HTTP with a fluent API. Latest version: 8.1.2, last published: 3 months ago. Start using superagent in your project by running `npm i superagent`. There are 9872 other projects in the npm registry using superagent.
www.npmjs.com
728x90