zzyxyz_server/README.md

64 lines
2.3 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/ // 项目根目录
├── server.js
├── utils.js // 各项通用接口(未来将会更改位置)
├── package.json
├── package-lock.json
├── .env
├── .gitignore
├── README.md
├── main/ // 主函数入口
│ ├── web.js // 启动代码
├── routes/ // 路由
│ ├── index.js // 连接所有路由(其中api路由在controllers/api/index.js中)
│ ├── files.js // 文件相关路由
│ └── users.js // 用户相关路由
├── controllers/ // 控制器(主要中间件执行逻辑,用到services和utils)
│ ├── api/ // API控制器
│ ├── files/ // 文件控制器
│ └── users/ // 用户控制器
├── services/ // 服务(主要服务逻辑,用到utils)
│ ├── auth.js // 身份验证服务(废案)
│ ├── files.js // 文件服务
│ └── users.js // 用户服务
├── utils/ // 工具库
│ ├── db.js // 数据库定义
│ ├── auth_utils.js // 身份验证服务
│ ├── db_utils.js // 数据库接口
│ └── db_api.js // better-sqlite官方文档截至于24-04-11
└── static/
├── css/ // css
├── js/ // js
├── img/ // 图片
└── index.html // 公开的静态首页
- 默认首页简易解释
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