feat: Custom Server Routes for external backend api
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- nuxt, typescript
調査の方向性
まず、提案されている /server/external/api.ts エントリーポイントと、既存の Nuxt サーバールートの設定方法を調査します。defineExternalApi、runtimeConfig.apiBase、ルートメソッド、ヘッダー、クエリ、Cookie がどのように組み合わさるかを確認します。リクエストごとに個別のサーバールートを用意せず、DevTools で外部 API を割り当ててテストできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
🆒 Your use case
Server routes are amazing for testing api routes quickly but in a lot of use cases we could be using an external backend and we want to be able to assign them and test them directly in the devtools.
🆕 The solution you'd like
A method in the /server directory to assign external api routes with the sole purpose to assign external apis, my suggestion is /server/external/api.ts where we can modify the external backend settings directly inside this file:
export default defineExternalApi((event) => {
const runtimeConfig = useRuntimeConfig()
event.baseUrl = runtimeConfig.apiBase
return {
'/login': {
method: 'POST',
headers: [...], // these are defaults that are modifiable
queries: [...],
cookies: [...]
},
'/logout': {
method: 'GET',
...
}
}
})
for compatibility we could build a tool to convert directly from postman or .rest files etc.
🔍 Alternatives you've considered
Implementing a nuxt server route for every single request and routing everything through it but it's absolutely not efficient.
ℹ️ Additional info
I believe this will heavily improve the development experience across teams and if some documentation was able to be implemented directly into them too it would mean that any api service can build with whatever accepted format and plug the documentation directly into nuxt which would make it such a powerful tool for teams and individuals.
- 主要言語
- TypeScript
- スター
- 3.3k
- フォーク
- 214
- 平均マージ
- 19時間 45分
- マージ済み PR(30日)
- 12
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nuxt/devtools のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
bug needs reproduction
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
似ている issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Crush オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/cln-application#167 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Quantco/pnpm-licenses#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100