Notice
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- jest
- lightsail nodejs apache
- TypeScript
- git pair
- ESLint
- 객체참조 #객체
- this
- NPM
- OOP
- 기후변화
- url #querystring
- 클로저
- #cloudfront #s3 #html 확장자 없애기
Archives
- Today
- Total
Hello World...
axios params -> fetch query 본문
axios get params 를 fetch 로는 어떻게 보내야 하는 지 검색을 하다 아래처럼 하면 된다는 것을 알게 되었다.
axios get params
axios
.get('http://coupontest.io/coupon', {
params: {
coupon: 'coupon-data'
}
}).then(.....)
fetch 에서는 아래처럼
var url = new URL('http://coupontest.io/coupon');
var params = { coupon: 'coupon-data' };
url.search = new URLSearchParams(params).toString();
fetch(url)
.then((res) => res.json())
.then((res) => console.log(res))
.catch((err) => console.log(err));
https://stackoverflow.com/questions/35038857/setting-query-string-using-fetch-get-request
Setting query string using Fetch GET request
I'm trying to use the new Fetch API: I am making a GET request like this: var request = new Request({ url: 'http://myapi.com/orders', method: 'GET' }); fetch(request); However, I'm unsure h...
stackoverflow.com
'javascript' 카테고리의 다른 글
| await setTimeout (0) | 2023.07.14 |
|---|---|
| onmouseover & onmouseout 로 이미지 변경하기 (0) | 2020.12.04 |
| html, css, javascript 모달창 만들기 (0) | 2020.05.13 |
| javaScript Promise 헷갈리는 점 추가 (0) | 2020.02.05 |
| es6 promise 예제 만들어보기 (0) | 2020.02.04 |
Comments