It works fine but no external resources are shown - my browser gives me the following error message: "XMLHttpRequest cannot loadhttp://xxx.xxx/xxx/wallpaper_ 01.jpg. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin."
I don't know node.js at all. How do I have to change the script to get it work?
var connect = require('connect');
var serveStatic = require('serve-static');
var app = connect();
app.use(serveStatic("./_ distribution"));
app.listen(3000);
Thanks a lot
> Yesterday I tried to use a little node.js script as localhost in my website development workflow.
>
> It works fine but no external resources are shown - my browser gives me the following error message: "XMLHttpRequest cannot loadhttp://xxx.xxx/xxx/wallpaper_ 01.jpg. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin."
>
> I don't know node.js at all. How do I have to change the script to get it work?
Your question is not about node; it's about how web browsers and web servers work. Please read:
https://developer.mozilla.org/ en-US/docs/Web/HTTP/Access_ control_CORS
>
> It works fine but no external resources are shown - my browser gives me the following error message: "XMLHttpRequest cannot loadhttp://xxx.xxx/xxx/wallpaper_
>
> I don't know node.js at all. How do I have to change the script to get it work?
Your question is not about node; it's about how web browsers and web servers work. Please read:
https://developer.mozilla.org/
댓글 없음:
댓글 쓰기