feat: Custom Server Routes for external backend api
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- nuxt, typescript
- Ambito
- api, developer-experience, devtools
Direzione di ricerca
Inizia esaminando l'entry point proposto /server/external/api.ts e il modo in cui sono configurate le route server Nuxt esistenti. Determina come si integrerebbero defineExternalApi, runtimeConfig.apiBase, i metodi delle route, gli header, le query e i cookie; il lavoro è concluso quando le API esterne possono essere assegnate e testate in DevTools senza una route server separata per ogni richiesta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🆒 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.
- Lingua principale
- TypeScript
- Stelle
- 3.3k
- Fork
- 214
- Merge medio
- 19h 45m
- PR unite (30g)
- 12
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nuxt/devtools
-
fix: Inspect panel styles break when host page sets a custom html font-size (rem-based units) Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
feat: Nuxt devtools for AI Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
bug needs reproduction
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
Tutte le issue di nuxt/devtools
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
AOSSIE-Org/DebateAI#582 · 2 commenti ·