詳細資訊
function callAPI({ path, method, data }) { const ROOT_URI = `https://${process.env.MAILCHIMP_REGION}.api.mailchimp.com/3.0`; return fetch[1](`${ROOT_URI}${path}`, { method, headers: { Accept: application/json, Authorization: `Basic ${Buffer.from(`apikey:${process.env.MAILCHIMP_API_KEY}`).toString( base64, )}`, }, body: JSON.stringify(data), }); } References fetch (www.tabnine.com)
這則整理對你有幫助嗎?
感謝你的回饋 🙏
相關查詢
同類結果
同一主題其他結果
🩺
Request using node
dev.to
2020年10月20日—constfetch=require('node-fetch');asyncfunctionget_request()consturl='http://get-request-ur...
🩺
異步函數- 提高Promise 的易用性
developers.google.com
2021年2月25日—asyncfunctionlogFetch(url)tryconstresponse=awaitfetch(url);console.log(awaitresponse.text()...
🩺
node-fetchnode-fetch: A light
github.com
Usenativepromiseandasyncfunctions.UsenativeNodestreamsforbody,onbothrequestandresponse.Decodecontentencodi...
🩺
Javascript node
stackoverflow.com
IthinkyouneedtoreturnretrieveLogsfunctionresultlikethis:asyncfunctionretrieveLogs()returnawaitfetch(url).t...
🩺
async await fetch in node
stackoverflow.com
isthistheobjectI'mlookingfor?Itistheresponseobject.Youwanttheresultsofextractingtheresponsebodyfromtheresp...
🩺
5 Ways to Make HTTP Requests in Node.js using AsyncAwait
www.twilio.com
2020年3月19日—npminstallnode-fetch@2.6.0.Recentversionsofthislibraryusepromises,sowe'reabletouseasync/awa...
🩺
NodeJS with AsyncAwait · GitHub
gist.github.com
varfetch=require('node-fetch').asyncfunctiongetDataFromAPI().letresponse=awaitfetch(https://api.github.com...
🩺
node
www.tabnine.com
exportdefaultasyncfunctionfetch()constres=awaitthis.page.evaluate((...args)=>//Thisisrunwithinthebrows...
🩺
How to Use Fetch with asyncawait
dmitripavlutin.com
2021年2月18日—Howtousefetch()withasync/awaitsyntaxinJavaScript:fetchJSONdata,handleerrors,makeparallelrequ...
延伸參考