3 ms·
You can impose a timeout on a fetch with a one liner: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static https://developer.mozilla.org
by esprehn 2y ago
You can impose a timeout on a fetch with a one liner:
https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal...
Part of the awkwardness in the post is also mixing what looks like express with promises. I think using an async function as the handler with express 5 would probably feel a lot nicer.
I agree about CORS being frustrating. I think we should have allowed totally anonymous fetch requests across domains for saved to home screen PWAs (or with a permission prompt.) Missing that feature means you end up needing native apps for a lot of things that otherwise are totally reasonable web apps. CORS does make sense though because the alternative is drive by attacks against your local network from random web pages. And since the S in IOT stands for security that seemed like a bad idea at the time.