# 测试API接口 ## 🔍 快速测试步骤 ### 1. 测试后端服务 在浏览器中访问以下URL,检查后端是否正常: ``` http://localhost:8081/api/book/today-recommend?limit=8 ``` **期望返回**: ```json { "code": 200, "message": "操作成功", "data": [ { "id": 1, "title": "西游记", "author": "(明) 吴承恩", ... } ] } ``` ### 2. 测试畅销书籍接口 ``` http://localhost:8081/api/book/bestsellers?limit=10 ``` ### 3. 使用curl测试 ```bash # 测试今日推荐 curl http://localhost:8081/api/book/today-recommend?limit=8 # 测试畅销书籍 curl http://localhost:8081/api/book/bestsellers?limit=10 ``` ### 4. 检查数据库 ```sql USE books_db; -- 检查书籍数量 SELECT COUNT(*) FROM books WHERE status = 1; -- 如果数量为0,执行插入脚本 ``` --- **创建时间**:2024年