loopbackio / loopbackio/loopback-next

Docs: How to receive context in controller

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

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

developer-experience Docs good first issue help wanted
主要言語
TypeScript
スター
5.1k
フォーク
1.1k
平均マージ
2日 21時間
マージ済み PR(30日)
27

説明

Is there any way to receive the context inside a controller?

Goal is to access request data (headers, ip, etc.)

Thanks

Acceptance criteria

  • a section in Controllers.html explaining how to access request and response headers or body by using decorators like @inject(RestBindings.Http.REQUEST) public request: Request for different cases:
    • A request header shared by most (or all) endpoints and processed by an express middleware/LB4 sequence action. Example: Authorization or X-API-Key.
    • A request header shared by many endpoints but used internally in the endpoint implementation (an express route handler/LB4 controller method). Maybe come up with a somewhat realistic example of such header.
    • A response header set by an express middleware/LB4 sequence action. For example X-Rate-Limit information provided by a rate-limiting extension in all responses.
    • A response header set by the endpoint (an express route handler/LB4 controller method). An example: Location header included ind 201 Created responses.

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

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

はじめの一歩

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

調査の方向性

Controllers.html と、文書化されている @inject(RestBindings.Http.REQUEST) パターンから始めます。middleware または sequence actions、ならびに controller methods におけるリクエストとレスポンスのヘッダーまたはボディを扱う例を追加します。Authorization または X-API-Key、rate-limit、Location のケースを含め、その後、すべての受け入れ基準が満たされていることを確認します。

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

評価

技術スタック
express, typescript
領域
api, documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

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

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