Generator này được sử dụng để kết nối các dự án với nhau, chẳng hạn như các trang web gọi API. Chỉ cần chọn dự án nguồn (ví dụ: dự án sẽ gọi API của bạn) và dự án đích (ví dụ: dự án API của bạn), và generator này sẽ xử lý việc tích hợp cả hai.
pnpm nx g @aws/nx-plugin:connection
yarn nx g @aws/nx-plugin:connection
npx nx g @aws/nx-plugin:connection
bunx nx g @aws/nx-plugin:connection
Bạn cũng có thể thực hiện chạy thử để xem những tệp nào sẽ bị thay đổi pnpm nx g @aws/nx-plugin:connection --dry-run
yarn nx g @aws/nx-plugin:connection --dry-run
npx nx g @aws/nx-plugin:connection --dry-run
bunx nx g @aws/nx-plugin:connection --dry-run
Cài đặt Nx Console VSCode Plugin nếu bạn chưa cài đặt Mở Nx Console trong VSCode Nhấp Generate (UI) trong phần "Common Nx Commands" Tìm kiếm @aws/nx-plugin - connection Điền các tham số bắt buộc Nhấp Generate
Tham số Kiểu Mặc định Mô tả sourceProject Bắt buộc string - Dự án nguồn targetProject Bắt buộc string - Dự án đích để kết nối tới sourceComponent string - Component nguồn để kết nối từ đó (tên component, đường dẫn tương đối so với thư mục gốc của dự án nguồn, hoặc generator id). Sử dụng '.' để chọn rõ ràng dự án làm nguồn. targetComponent string - Component đích để kết nối tới (tên component, đường dẫn tương đối so với thư mục gốc của dự án đích, hoặc generator id). Sử dụng '.' để chọn rõ ràng dự án làm đích. preferInstallDependencies boolean true Có nên cài đặt các dependencies sau khi generator chạy hay không. Đặt thành false để trì hoãn việc cài đặt khi chạy nhiều generator liên tiếp (việc cài đặt vẫn sẽ chạy nếu cần thiết để các generator tiếp theo có thể tính toán Nx project graph); cài đặt một lần vào cuối.
Generator Connection hỗ trợ các kết nối sau:
React to tRPC Call a tRPC API from a React website React to FastAPI Call a Python FastAPI from a React website React to Smithy API Call a Smithy API from a React website React to Python Agent Call a Python Agent from a React website React to TypeScript Agent Call a TypeScript Agent from a React website React to AG-UI Agent Call an Agent exposing the AG-UI protocol from a React website via CopilotKit Python Agent to MCP Connect a Python Agent to an MCP server TypeScript Agent to MCP Connect a TypeScript Agent to an MCP server Python Agent to A2A Agent Connect a Python Agent to a remote A2A agent TypeScript Agent to A2A Agent Connect a TypeScript Agent to a remote A2A agent tRPC API to Relational Database Connect a tRPC API to an Aurora relational database Smithy API to Relational Database Connect a Smithy API to an Aurora relational database TypeScript Agent to Relational Database Connect a TypeScript Agent to an Aurora relational database TypeScript MCP Server to Relational Database Connect a TypeScript MCP Server to an Aurora relational database FastAPI to Python Relational Database Connect a FastAPI to a Python Aurora relational database Python Agent to Python Relational Database Connect a Python Agent to a Python Aurora relational database Python MCP Server to Python Relational Database Connect a Python MCP Server to a Python Aurora relational database tRPC API to TypeScript DynamoDB Connect a tRPC API to a DynamoDB table Smithy API to TypeScript DynamoDB Connect a Smithy API to a DynamoDB table TypeScript Agent to TypeScript DynamoDB Connect a TypeScript Agent to a DynamoDB table MCP Server to TypeScript DynamoDB Connect a TypeScript MCP Server to a DynamoDB table FastAPI to Python DynamoDB Connect a FastAPI to a DynamoDB table Python Agent to Python DynamoDB Connect a Python Agent to a DynamoDB table Python MCP Server to Python DynamoDB Connect a Python MCP Server to a DynamoDB table AgentCore Gateway to MCP Server Aggregate an MCP server behind an AgentCore Gateway AgentCore Gateway to AgentCore Gateway Aggregate an AgentCore Gateway behind another AgentCore Gateway TypeScript Agent to AgentCore Gateway Connect a TypeScript Agent to an AgentCore Gateway Python Agent to AgentCore Gateway Connect a Python Agent to an AgentCore Gateway AgentCore Gateway to Agent Front an agent with an AgentCore Gateway as a runtime target React Website to AgentCore Gateway Connect a React website to agents through an AgentCore Gateway