feat: Custom Server Routes for external backend api
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- nuxt, typescript
- Lĩnh vực
- api, developer-experience, devtools
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra entry point /server/external/api.ts được đề xuất và cách các server route hiện có của Nuxt được cấu hình. Xác định cách defineExternalApi, runtimeConfig.apiBase, các method của route, header, query và cookie sẽ kết hợp với nhau; hoàn thành có nghĩa là có thể gán và kiểm thử các API bên ngoài trong DevTools mà không cần một server route riêng cho từng request.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🆒 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.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.3k
- Fork
- 214
- Merge trung bình
- 19 giờ 45 phút
- Pull request đã merge (30 ngày)
- 12
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nuxt/devtools
-
fix: Inspect panel styles break when host page sets a custom html font-size (rem-based units) Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
feat: Nuxt devtools for AI Đang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
bug needs reproduction
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Tất cả issue của nuxt/devtools
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·