angular / angular/angular-cli

Allowing using middleware config in dev server options

オープン
#32,811 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
angular/build:dev-server area: @angular/build gemini-triaged
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### 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_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by tracing the serve command's dev-server options and the existing proxyConfig implementation, then inspect how angular.json server options are parsed and how angular/build injects development-server configuration. Done means middlewareConfig accepts a JavaScript file exporting one middleware function or an array, and the configured middleware runs in the dev server.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
build-system, cli
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。