目录
The Deep Digest App Backend Controller
This is project App of DeepDigest Inc. for simplifying the backend server development.
Our server group guys have made lots of discussions about which tools we should adopt, and we choose node.js, the baby but powerful platform. Then we talked about pure js, traceur, babel and so on. Finally, we made a united decision on that it must be typescript - microsoft's typed javascript.
This server framework is aimed at the goal - "simple, fast, debug-faced and stable". It's used for holding the big application logic level layer of our backend system. For now we have done many awesome features like tasks switch, debug information info and request-response object initialize. In the future, we will try our best to get continual improvements. Good luck for this team!
Build
Use the typescript compiler to compile the code set. For more information, you should check the tsconfig.ts file.
测试
We use a well-known combination set - jest and superagent. You are to use npm test script to test all the code, like:
npm test
部署
安装nodejs
- 安装nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
- 重新进入shell.
- 使用
command -v nvm
确认nvm安装成功. - 使用
nvm install node
或者nvm install node --lts
安装node. - 使用
npm install -g npm
升级npm.
安装pm2
- 使用
npm install -g pm2
安装pm2. - 使用
pm2 install pm2-logrotate
安装log rotate工具.
上传代码至服务器
- 将需要上传的服务器文件打包.
- 上传之后解压缩.
运行
- 分别进入不同的工程目录, 使用
pm2 start app
或者pm2 start admin
启动应用.
注意:
为了保持API兼容性,我们采取以下策略:
- 借用SemVer的概念,对API版本,我们使用major.minor.patch这种方式标识API版本。
- 从REST URI上我们只能看到公开的major版本,例如:/api/1/user/gogo。内部完整版本请参考package.json。
- 一个REST API的URI和返回值组成一个最小二元组,任何一个元素发生变化都表示版本发生变化。例如:URI不变而返回值发生变化,我们也认为其API版本发生变化。
- major版本代表API发生了重大变化以至于必须打破向后兼容性。此时我们将会改变URI中的API版本字符串,而REST返回值等也将发生相应变化。
- minor版本代表API发生了扩增,以前的API保持兼容。此时我们采用增加API URI或扩增返回值的方式来扩增功能,这样,新的功能可以使用新的URI、新的返回值字段,而旧的功能继续使用旧的API。
- patch版本代表API没有发生变化,全部保持兼容性。此时我们只是对功能做了一定的修补,但保持所有的URI和返回值均不发生变化。
TODO
- 模拟明星或组织, 与用户进行交流.
Code of Conduct
- You are not rambo. Remember that we are a team.
- Please invite someone to review your code, again, you are not immortal.
- Never blame any workmate for the quality of code set, you should know that boss already fined the poor guy.
Contributor
- Jason - XmT Inc.
- Cris - XmT Inc.
- Becky - XmT Inc.
Rangeragent - XmT Inc.