Node.js 对glitch.me服务器的跨源请求

Node.js 对glitch.me服务器的跨源请求,node.js,cors,glitch-framework,Node.js,Cors,Glitch Framework,我已经在glitch.me上创建了一个服务器,我正在尝试从该服务器提供数据,但出现了以下错误。 从源“”获取“”的localhost/:1访问已被CORS策略阻止: 请求的服务器上不存在“Access Control Allow Origin”标头 资源。如果不透明的响应满足您的需要,请设置请求的 模式设置为“无cors”,以获取禁用cors的资源 我真的不知道如何解决这个问题 import React, {Component} from "react" class quotes extend

我已经在glitch.me上创建了一个服务器,我正在尝试从该服务器提供数据,但出现了以下错误。 从源“”获取“”的localhost/:1访问已被CORS策略阻止:

请求的服务器上不存在“Access Control Allow Origin”标头 资源。如果不透明的响应满足您的需要,请设置请求的 模式设置为“无cors”,以获取禁用cors的资源

我真的不知道如何解决这个问题

import React, {Component} from "react"

class quotes extends Component {
    constructor(props) {
        super(props);
        this.state = {
            error: null,
            isLoaded: false,
            quotes: quotes
        };
    }

componentDidMount() {
    fetch("https://clem-quote-server.glitch.me/quotes")
      .then(res => res.json())
      .then(
        (result) => {
            this.setState({
            isLoaded: true,
              quotes: result.quotes
          });
        },
        error => {
          this.setState({
            isLoaded: true,
            error
          });
        }
      );
}

    render() {
        const { error, isLoaded, quotes } = this.state;
        if (error) {
            return <div>Error: {error.message}</div>;
        } else if (!isLoaded) {
            return <div>Loading...</div>;
        } else {
            return (
              <ul>
                {quotes.map(quote => {
                    return quote;

                }  
                )}
              </ul>
            );
        }
    }
}       
    export default quotes;
import React,{Component}来自“React”
类引号扩展组件{
建造师(道具){
超级(道具);
此.state={
错误:null,
isLoaded:false,
引号:引号
};
}
componentDidMount(){
取回(“https://clem-quote-server.glitch.me/quotes")
.then(res=>res.json())
.那么(
(结果)=>{
这是我的国家({
isLoaded:是的,
引号:result.quotes
});
},
错误=>{
这是我的国家({
isLoaded:是的,
错误
});
}
);
}
render(){
const{error,isLoaded,quotes}=this.state;
如果(错误){
返回错误:{Error.message};
}否则,如果(!已加载){
返回装载。。。;
}否则{
返回(
    {quotes.map(quote=>{ 返回报价; } )}
); } } } 导出默认报价;

我希望能够在每次页面加载时显示数组列表中的一个对象,因为CORS失败,当服务器和客户端处理不同的域时,必须包括CORS

标题中包含COR

以下是如何在react应用程序中启用corse:

CORS信息:


由于CORS的原因,它失败了,当服务器和客户端处理不同的域时,必须包括CORS

标题中包含COR

以下是如何在react应用程序中启用corse:

CORS信息:

请参阅,其他答案请参阅,其他答案请参阅