We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
趁着团队react培训的机会,我写了一个todolist的后端项目,以供前端接口调用。仓库地址:https://github.com/youngwind/todo-backend
开发一个基本的node后端所需要的基础知识在之前的博客中已经大部分提到了,大概整理罗列如下。
项目还有很多问题有待优化,比如:
参考资料:
自己在使用这个todo-backend的时候发现请求跨域了,一般解决方案如下
app.all('*', function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With"); res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS"); res.header("X-Powered-By",' 3.2.1') res.header("Content-Type", "application/json;charset=utf-8"); next(); });
本质上是一个中间件,应该有第三方成熟的工具来完成这事儿。我找到了cors
var cors = require('cors'); app.use(cors());
使用起来非常方便。
参考资料:http://www.tuicool.com/articles/vYBR3y
The text was updated successfully, but these errors were encountered:
棒
Sorry, something went wrong.
No branches or pull requests
趁着团队react培训的机会,我写了一个todolist的后端项目,以供前端接口调用。仓库地址:https://github.com/youngwind/todo-backend
开发一个基本的node后端所需要的基础知识在之前的博客中已经大部分提到了,大概整理罗列如下。
项目还有很多问题有待优化,比如:
参考资料:
更新
跨域问题
自己在使用这个todo-backend的时候发现请求跨域了,一般解决方案如下
本质上是一个中间件,应该有第三方成熟的工具来完成这事儿。我找到了cors
使用起来非常方便。
参考资料:http://www.tuicool.com/articles/vYBR3y
The text was updated successfully, but these errors were encountered: