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 701
刺人心
刺人心 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: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.

提交回复
热议问题