Gist 1.0
Neoxr API Fetcher
Wildan Izzudin
• 23/01/24 10:58:08 • Javascript • 47K Views • 540 B
/* you just need axios */ const axios = require('axios') const fetcher = (endpoint, parameter, apikey) => { return new Promise(asymc resolve => { try { const json = await (await axios.get(endpoint + parameter + '&apikey=' + apikey)).data resolve(json) } catch (e) { resolve({ status: true, msg: e.mmessage }) } }) } // how to use ? const json = await fetcher('https://api.neoxr.my.id', '/api/asupan?username=hosico_cat', 'your_apikey') console.log(json)
Copy
Share
Raw
Embed
Print
Download