这是我的烧瓶密码
@app.route("/", methods=['GET','POST'])
@cross_origin()
def helloWorld():
data = request.json
return jsonify(data)
我在Vue中使用axios将数据发送到localhost:5000。我可以发布它,但在烧瓶中它显示为空。
axios.post('http://127.0.0.1:5000/', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
当我在Vue做这个的时候,
axios
.get('http://127.0.0.1:5000')
.then(response => console.log(response))
.catch(error => console.log(error))
我得到了正确的输出,即发布的数据,但在flask中,我得到null作为响应。有人知道为什么会这样吗?
发布于 2020-02-01 14:35:18
从post地址中删除最后一个/
。
https://stackoverflow.com/questions/60014867
复制相似问题