【发布时间】:2020-08-12 21:23:11
【问题描述】:
我刚刚学习 React,所以我有点困惑,我无法连接到我的脚本后端,我在控制台中遇到 404 错误。这项工作附带的那些很好,只有我制作的自定义似乎坏了。
另外转发网址是正确的,我可以使用GET,只是不能使用POST
我正在使用https://github.com/tomlovesgithub/FullstackMERNTDDTutorial/
router.js 后端
router.post("/processLogin", (req, res) => { console.log('hello 1') });
index.jsx frontend 我把文件改成了.jsx
axios.get(`${PORT}/processLogin`, { content: 'hi' }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); });
控制台
xhr.js:178 GET http://localhost:3001/processLogin 404 (Not Found)
【问题讨论】:
标签: reactjs express react-router axios babeljs