Hi
I’m having issue with my first app which I can’t resolve.
on the back end I’m have the code:
app.get('/', (req, res) => res.send('Hello World!'));
and on front end I’m trying to catch that hello world with:
fetch('http://127.0.0.1:3000', {
mode: 'no-cors',
}).then((response) => console.log(response));
The response I’m getting is:
Response {type: "opaque", url: "", redirected: false, status: 0, ok: false, …}
body: (...)
bodyUsed: false
headers: Headers {}
ok: false
redirected: false
status: 0
statusText: ""
type: "opaque"
url: ""
__proto__: Response
So you can see there is status code 0. When I tested back end with postman it returned Hello World with status code 200 OK but from browser it doesn’t and I can’t figure out what is the problem.
I added “mode: no-cors” because I was getting that error.