【发布时间】:2021-04-29 17:31:49
【问题描述】:
自从我迁移到 Mongodb Atlas 后,我遇到了 cors 错误。
我在 mongodb 仪表板上找到的唯一 URL 是 mongodb+srv://<username>:<password>@cluster0.cnh0m.mongodb.net/myFirstDatabase
这是我的代码:
getClap = async () => {
try {
const res = await axios.get(`mongodb+srv://...`)
console.log(res.data);
} catch (err) console.error(err);
};
有什么方法可以像以前使用 mlab 一样将 mongodb 直接与 axios 连接?使用 HTTPS 地址?
【问题讨论】:
标签: reactjs mongodb axios mongodb-atlas