Allowing using middleware config in dev server options

Đang mở
#32,811 0 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
52/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
angular, typescript
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Bắt đầu bằng cách lần theo các tùy chọn dev-server của lệnh serve và phần triển khai proxyConfig hiện có, sau đó kiểm tra cách các tùy chọn máy chủ trong angular.json được phân tích cú pháp và cách angular/build chèn cấu hình máy chủ phát triển. Được xem là hoàn tất khi middlewareConfig chấp nhận một tệp JavaScript export một hàm middleware hoặc một mảng, và middleware được cấu hình chạy trong máy chủ phát triển.

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

Mô tả

angular/build:dev-server area: @angular/build gemini-triaged
Command

serve

Description

Dev server middleware configuration is very commonly used in development,such as auto login or log printing,but it is not currently supported。

Describe the solution you'd like

Refer to the implementation of proxyConfig, add the middlewareConfig configuration to angular.json -> server -> options, and parse and inject the middleware in angular/build.
middlewareConfig supports configuring a js file path, and the file exports a single middleware function or an array of multipe middleware functions. such as:

function log(req, res, next) {
    next()
}

module.exports  = log;
function log(req, res, next) {
    next()
}

function auth(req, res, next) {
    next()
}

module.exports =
    [
        log,
        auth,
    ]
Describe alternatives you've considered

No response

Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
16 giờ 21 phút
Pull request đã merge (30 ngày)
170

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 angular/angular-cli

Tất cả issue của angular/angular-cli

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.