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

后端 未结 3 700
刺人心
刺人心 2020-12-11 15:16

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

相关标签:
3条回答
  • 2020-12-11 15:57

    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)

    0 讨论(0)
  • 2020-12-11 15:59

    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.

    0 讨论(0)
  • 2020-12-11 16:19

    Add to script tag type='text/javascript'

    0 讨论(0)
提交回复
热议问题