Reactjs React Mongodb加载资源失败:未找到net::ERR_文件
我正在尝试使用react和mongodb的浏览器扩展应用程序。Reactjs React Mongodb加载资源失败:未找到net::ERR_文件,reactjs,mongodb,post,localhost,Reactjs,Mongodb,Post,Localhost,我正在尝试使用react和mongodb的浏览器扩展应用程序。POST操作是: create(urls){ console.log(urls); return new Promise((resolve, reject) =>{ fetch('http://localhost:3001/url', { method: 'POST', body: JSON.stringify(urls), headers: {
POST
操作是:
create(urls){
console.log(urls);
return new Promise((resolve, reject) =>{
fetch('http://localhost:3001/url', {
method: 'POST',
body: JSON.stringify(urls),
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
}
})
.then(result => result.json())
.then(json => resolve(json))
.catch(err => {
reject(err);
});
});
}
问题是,有时数据发送得很完美。但大多数时候我都会犯这样一个奇怪的错误:
Failed to load resource: net::ERR_FILE_NOT_FOUND
在中刷新扩展应用程序时,我也会遇到类似的错误
chrome://extensions/
,即:
POST chrome-extension://my_ext_id/url net::ERR_FILE_NOT_FOUND
我认为这个错误与http://localhost:3001/url
我已授予如下权限:
"permissions": ["alarms", "tabs", "http://localhost:3001/url"],
但它似乎没有像我希望的那样起作用
任何帮助都将不胜感激