Muhammad Mahmoud
Recommendations to write a standard-compliant nitro endpoints
Hello 👋
I'm building a full-stack app with Nuxt & Nitro. It's my first time working on the backend in a big product.
I'm trying to find a spec/convention for the api endpoints I create (body & return types for example).
I searched and asked LLMs but I think i'm not asking the right question because I get unrelated answers 😅
A link to a guide, or maybe an ESLint rule would be great. Thanks!
5 replies
Question about using SWR/ISR with user auth
Hello
I'm thinking about enabling swr for some pages to avoid waiting for rendering everytime and enhance the response time. But I'm worried it would cause conflicts with user state.
An example is I have a Login button in the header which shows a user dropdown if logged in and a Logout button. Are these would be handled properly if using swr or do I have to make certain adjustments?
3 replies
Calling an API on my local machine from within a container only works at first load
Hey guys 👋 I'm running a Nuxt app inside a Docker container that talks to my local machine Laravel API on
localhost:8000
.
I've added these lines in my docker-compose
file to make the container see my localhost.
.env
Although The initial page load works, the subsequent link clicks fail with a 404 error as the browser send the requests to http://host.docker.internal:8000/api/some-api-endpoint
and don't find it.
I guess I need some sort of two-way mapping but I don't have a clue where to start looking.1 replies
`defu` doesn't override the value if `undefined` is passed
Hey 👋 We're using a
useFetch
wrapper to pass extra headers, etc with each request.
We want to cache all data by default using getCachedData
and opt-out from this when needed
It's working okay but when opting out by passing undefined
to getCachedData
it doesn't apply it. Is there a way to tell defu
that I want to explicitly set the key to undefined
or do I have to always pass a function that returns undefined
as a value?1 replies