Allowing using middleware config in dev server options

オープン
#32,811 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

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

調査の方向性

まず、serve コマンドの dev-server オプションと既存の proxyConfig 実装をたどり、次に angular.json のサーバーオプションがどのように解析され、angular/build が開発サーバーの設定をどのように注入するかを調べます。middlewareConfig が 1 つの middleware 関数または配列を export する JavaScript ファイルを受け付け、設定された middleware が dev server で実行されれば完了です。

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

説明

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

主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
16時間 21分
マージ済み PR(30日)
170

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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