Something like https://httpstat.us/ but for API endpoints?
Videos
The problem is here you want to return from fetch browser API, which returns Promise. If you really want to do it, for instance, instead of using useState hook in React to call and save the response in component state, then you need to wrap your fetch request into async IIFE function and use await statement to wait the async request to be fulfilled and the data to be resolved by Promise. For more info, you can refer: JS Fetch API access return value
write your fetch in an useEffect and set its response in a state
const [data, setData] = useState()
useEffect(() => {
fetch('API_URL', {method:"GET"})
.then(res => {
return JSON.parse(res);
}).then(response => {
setData(response)
})
}, [])
I have design of a dashboard and and i wanna create a simple dummy api which contains all these data which are being shown in this dashboard and and there line chart in that dashboard which needs to be interactive with data of that dummy api
» npm install node-dummy-api