index.js
704 Bytes
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
const url = 'https://api.upbit.com/v1/market/all';
const options = { method: 'GET', headers: { Accept: 'application/json' } };
const express=require('express');
const app=express();
async function test() {
let response= await fetch(url, options)
.then(res => res.json())
.then(json => {
console.log(json);
console.log(json.length);
return json;
})
var hello=await (await fetch(url,options)).json();
return hello;
}
app.get('/fetch_test',async (req,res)=>{
res.json(await test());
})
app.listen(5000,()=>{
console.log('server')
})