1
This commit is contained in:
40
server/README.md
Normal file
40
server/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
## server(Koa + Sequelize + MySQL)
|
||||
|
||||
### 功能
|
||||
- `POST /api/crawl/run_action`:服务端调用扩展 action,返回结果,并按 `stage` 自动入库
|
||||
- **定时任务写死配置**:`config/cron_tasks.js`(不走数据库)
|
||||
|
||||
### 运行
|
||||
1. 安装依赖
|
||||
|
||||
```bash
|
||||
cd server
|
||||
npm install
|
||||
```
|
||||
|
||||
2. 配置环境变量
|
||||
|
||||
```bash
|
||||
copy .env.example .env
|
||||
```
|
||||
|
||||
3. 初始化/更新表结构
|
||||
|
||||
```bash
|
||||
node scripts/db_sync.js
|
||||
```
|
||||
|
||||
4. 启动
|
||||
|
||||
```bash
|
||||
node app.js
|
||||
```
|
||||
|
||||
### 定时任务
|
||||
编辑 `config/cron_tasks.js` 的 `cron_task_list`,重启服务即可生效。
|
||||
|
||||
### 落库表
|
||||
- `crawl_run_record`:所有 action 调用的原始请求/响应
|
||||
- `amazon_product`:`stage=detail` 详情
|
||||
- `amazon_search_item`:`stage=list` 列表 item
|
||||
- `amazon_review`:`stage=reviews` 评论
|
||||
Reference in New Issue
Block a user