No 'Access-Control-Allow-Origin' - Node / Apache Port Issue

后端 未结 13 1684
有刺的猬
有刺的猬 2020-11-22 02:27

i\'ve created a small API using Node/Express and trying to pull data using Angularjs but as my html page is running under apache on localhost:8888 and node API is listen on

13条回答
  •  心在旅途
    2020-11-22 03:32

    Install cors dependency in your project:

    npm i --save cors
    

    Add to your server configuration file the following:

    var cors = require('cors');
    app.use(cors());
    

    It works for me with 2.8.4 cors version.

提交回复
热议问题