Is there a way in JavaScript to send an HTTP request to an HTTP server and wait until the server responds with a reply? I want my program to wait until the server replies an
For those using axios, you can wrap it in an async iife and then await it:
async
await
(async () => { let res = await axios.get('https://example.com'); // do stuff with the response })();
Note, I haven't done any error checking here.