zzyxyz_server/README.md

54 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 项目文件结构
root/
|- main/
| |- web.js 启动代码
|- routers/
| |- *.js 路由文件
| |- */ 各路由文件的子文件及使用的中间件
|- models/ 未来数据模型文件
|- views/ 视图文件(一般是不允许直接访问的文件,使用中间件访问)
|- static/ 静态文件(所有网页的静态资源存放处)
| |- css/ css文件
| |- js/ js文件
| |- pic/ 图片文件
| |- html/ html文件
| |- index.html 默认首页
|- .data/ 配置文件
|- .gitignore git忽略文件
|- package.json 项目依赖包
|- package-lock.json 项目依赖包(自动生成)
|- .env 配置文件(如需自己启用项目请根据default.env文件修改后启用项目)
|- server.js 主路由代码
|- utils.js 工具代码(包含路径,api返回格式)
- 默认首页简易解释
static/index.html 文件需要调用 static/js/base_script.js 动态加载在 static/html/base/*.html 的共享资源且需要动态引入.data内的json数据以渲染出一张张cards
## 前后端接口手册
- 请看utils.js的json内部格式
## 杂项
npm init
npm install [package names]
npm install
使用tmux
安装tmux如果尚未安装
bash
sudo apt-get install tmux # 对于Debian/Ubuntu系统
sudo yum install tmux # 对于CentOS/RedHat系统
启动一个新的tmux会话
bash
tmux
在tmux会话中启动你的Node.js应用
bash
node app.js
按下Ctrl + B然后按下D来“detach”分离tmux会话。
重新连接到tmux会话时运行
bash
tmux attach
https://zhuanlan.zhihu.com/p/667646001