Skip to content Skip to sidebar Skip to footer

Fetch Api Cannot Load File:///c:/users/jack/desktop/books_h/book-site/public/api/books. Url Scheme Must Be "http" Or "https" For Cors Request

Just started learning node js in my school. They gave us this half-finished task and i need to make the next and prev buttons work. However i get some errors in the console the mom

Solution 1:

Well this is what i had to do if it helps anyone in the future at all. This is all basic stuff but i am beginner so here we go. Open command prompt. Go to the destination of your project( where the index.js file is ) and write:

$ npm init -y
$ npm install -g express-generator
$ npm install express -S
$ npm install connect -S
$ npm install serve-static -S

then go to the destination of your server.js file and write

$ node server.js

After this i could run my page in browser typing http://localhost:8080/ in the URL.

Solution 2:

If you are under Windows, create a new site in your local IIS (you should enable IIS in Windows components if not already) to your project folder. Then open http://localhost:8080 (or other port you can setup in the ISS for your new site)

Solution 3:

Add to script tag type='text/javascript'

Post a Comment for "Fetch Api Cannot Load File:///c:/users/jack/desktop/books_h/book-site/public/api/books. Url Scheme Must Be "http" Or "https" For Cors Request"