Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Dynamic entrypoint

Đang mở
#248 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, typescript
Lĩnh vực
frontend, tooling

Hướng nghiên cứu

Bắt đầu bằng cách lần theo mã generator tạo ra config/entrypoint.js và xem xét cách API endpoint được truyền vào mã client đã tạo. Định nghĩa tùy chọn dynamic-entrypoint và xác minh rằng các client đã tạo có thể sử dụng host được truy cập thay vì yêu cầu chỉnh sửa sau khi tạo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description
There should be an option to have a dynamic entrypoint when generating client code.

Currently the API endpoint passed to the generator is also used as entrypoint. This is not optimal:

  1. A development setup may be accessed differently via CLI and via web (e.g. using internal service host names and public URLs in a Docker Compose setup)
  2. Different environments need different host names, hardcoding one will break requests.

Example
Running the generator with http://apache/api/ will generate all code and lead to exactly this being set in config/entrypoint.js. Now accessing http://app.local/<resource> will fail since apache is a host name internally resolved in a Docker Compose setup while the setup is accessed via app.local from the host machine.

Currently we work around this by adjusting entrypoint.js like this after generating the code:

export const ENTRYPOINT = `${location.protocol}//${location.host}/api/`;

Maybe this or similar could be integrated for dynamic entrypoints.

Ngôn ngữ chính
TypeScript
Star
376
Fork
132
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của api-platform/create-client

Tất cả issue của api-platform/create-client

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.