Closed skf-funzt closed 2 months ago
Someone is attempting to deploy a commit to a Personal Account owned by @enkot on Vercel.
@enkot first needs to authorize it.
@enkot I added the feature for automatic server API route creation. Could you please have a look?
Hi @skf-funzt
Sorry for not replying for a long time. Thanks for your PR! I really appreciate it. 💚
While the general idea is correct, my vision for the implementation is a bit different.
The idea is to have the same preconfigured client implementation in the Nuxt and Nitro context, same way we have plain $fetch
:
// Nuxt
const { $petsFetch } = useNuxtApp()
$petsFetch('/pet/{petId}', {
path: {
petId: 2
}
})
// Nitro
const { $petsFetch } = useNitroApp()
$petsFetch('/pet/{petId}', {
path: {
petId: 2
}
})
Because it requires quite a lot of changes changes in this branch, I created another PR - https://github.com/enkot/nuxt-open-fetch/pull/23. I will add you as a contributor there :)
@enkot What do you think about the automatic nitro route creation to avoid having CORS issues on the API's backend side?
I think handling CORS is beyond the scope of this module. NuxtOpenFetch simply extends $fetch
/useFetch
functionality with OpenAPI types.
OK understood. Thanks for pointing that out. I thought it would be nice to have an immediate solution for the CORS issues with certain backends as I ran into the same issue and this was the solution for me without using a different package.
@skf-funzt I noticed you made some changes regarding /utils
. Just want to note that utils
was removed, and functions for module and runtime are used in place now. So it should work correctly now :)
Features
Usage - Nitro Server support
nuxt.config.ts
server/api/pets.ts
Using automatic server API routes
Improvements
Missing
test:watch
is working properly