espruino / EspruinoDocs

See http://espruino.com for the complete Espruino Documentation - many links in this repository will not work
http://www.espruino.com/
Other
253 stars 282 forks source link

fixed a cors problem when serving files locally #714

Closed brendena closed 5 months ago

brendena commented 5 months ago

So this does two things. The module files don't get served with the server because there built in a different directory.

Then there seems to be a CORS problem. I'm guessing because the ide has a origin of https://www.espruino.com and the express server just rejects it. So i just set it to allow anyone to receive the file.

Fixes this error Access to fetch at 'http://localhost:3040/modules/BH1792.min­.js' from origin 'https://www.espruino.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

gfwilliams commented 5 months ago

This looks great, thanks!