Skip to content

获取项目详情

根据项目 ID 获取单个项目的详细信息。

接口信息

  • 请求路径: GET /api/projects/:id
  • 认证方式: 无需认证(公开接口)
  • 内容类型: application/json

路径参数

参数名类型必填说明
idnumber项目 ID

响应字段

字段名类型说明
idnumber项目 ID
titlestring项目标题
descriptionstring项目描述
contentstring项目详细内容(Markdown)
coverImagestring封面图片 URL
demoUrlstring演示链接
repoUrlstring代码仓库链接
techStackarray技术栈标签
screenshotsarray项目截图列表
likeCountnumber点赞次数
viewCountnumber浏览次数
statusstring状态:published/draft
createdAtstring创建时间
updatedAtstring更新时间

请求示例

bash
curl http://localhost:3000/api/projects/1

响应示例

json
{
  "success": true,
  "data": {
    "id": 1,
    "title": "个人博客系统",
    "description": "基于 Nuxt.js 3 的现代化博客系统",
    "content": "# 项目介绍\n\n详细的项目介绍内容...",
    "coverImage": "https://example.com/project1.jpg",
    "demoUrl": "https://demo.example.com",
    "repoUrl": "https://github.com/user/blog",
    "techStack": ["Nuxt.js", "TypeScript", "Tailwind CSS"],
    "screenshots": [
      "https://example.com/screenshot1.jpg",
      "https://example.com/screenshot2.jpg"
    ],
    "likeCount": 45,
    "viewCount": 230,
    "status": "published",
    "createdAt": "2024-01-15T10:00:00.000Z",
    "updatedAt": "2024-01-20T15:30:00.000Z"
  }
}

错误响应

HTTP 状态码说明
404项目不存在
500服务器错误

相关接口