全栈功能蓝图

端到端实现一个完整功能

提示词

请帮我实现一个完整的功能:[功能描述]

需要包含:
1. 数据库表结构/migration
2. 后端API(路由、控制器、模型)
3. 前端页面/组件
4. 状态管理
5. API调用
6. 错误处理
7. 加载状态
8. 基本样式

技术栈:[列出]

请按文件组织输出,每个文件用标注文件名。先输出文件结构,然后逐个文件给出代码。

示例输出

实现用户评论功能:

文件结构:

数据库:migration_create_comments.ts
后端:
  - comment.routes.ts
  - comment.controller.ts
  - comment.model.ts
前端:
  - CommentSection.tsx
  - CommentForm.tsx
  - CommentList.tsx
  - CommentItem.tsx

---

migration_create_comments.ts

export async function up(knex) {
  await knex.schema.createTable('comments', (table) => {
    table.increments('id');
    table.integer('post_id').references('id').inTable('posts');
    table.integer('user_id').references('id').inTable('users');
    table.text('content');
    table.timestamps();
  });
}

---

comment.routes.ts

...

0

评论 0

更多

登录后可点赞、收藏、评论和举报。

还没有评论,先发起一个具体问题。