项目已经发布到github上面,有需要下载的可以查看链接:https://github.com/zhuyangmsg/node-case。
一、思想
1、建立内部服务器,我采用的express模块,来快速开发。

2、开发接口,使用get、post建立接口链接。

3、建立数据库,设计表

4、建立数据库链接

5、业务逻辑处理,根据需求对数据库进行相应的操作
二、遇到的问题
1、跨域

2、不同的请求,需要不同的方式来接收数据
post请求数据,通过body-parser来接收

get请求数据,通过query来接收
// GET /shoes?order=desc&shoe[color]=blue&shoe[type]=conversereq.query.order
req.params
包含映射到指定的路线“参数”属性的对象
例如,如果你有route/user/:name,那么“name”属性可作为req.params.name。
几个方法点特别注意:
commit将本地项目移至到本地仓库。注意:是把缓存区的更改移至到仓库。所以,之前需要将本地项目移至缓存区(git add .)。
第一次登录的时候,配置用户信息:
配置用户名:git config --global user.name "你的名字"
配置e-mail:git config --global user.email "你的邮箱@xx.com"
git更改远程连接地址:
查看远程仓库:$ git remote -v
添加远程仓库:$ git remote add [name] [url]
删除远程仓库:$ git remote rm [name]
修改远程仓库:$ git remote set-url --push [name] [newUrl]
拉取远程仓库:$ git pull [remoteName] [localBranchName]
推送远程仓库:$ git push [remoteName] [localBranchName]
网友评论