jd
Custom, external, $fetch fetches the external API instead of the nuxt server, BUT only in production
I'm using the same setup locally and in production:
* caddy, running on the host, not in a docker container
* docker container for nuxt
* docker container for the api (FastAPI)
It works locally, but doesn't work on the VPS.
Here's some of the setup:
Caddyfile
docker-compose.yaml
nuxt/Dockerfile.prod
api.Dockerfile
nuxt/.env
api/.env
1 replies
Best way to save user context to avoid needing to fetch at every page?
What's the best, but mostly simple, way to save user context to avoid needing to fetch at every page?
The user context comes back from an API that I call server-side. Server Middleware helps me with the user context on the server-side, but I can't figure out how to replicate the same behavior for the pages/ directory
3 replies
Docker and Nuxt in production
I can't find the way to ask me question concisely
But I need help deploying my nuxt app in production
I'm currently running into the issue that my nuxt app (built with
generate
, ie SSG), and I can't find a way to make it use the right api base url to perform the requests through to the other docker container where the api is exposed through the docker network (but I don't want to expose the api to the public).
Anyone with experience with that that can help me out?7 replies
Best practices for state/composable to depend on fetched data?
I have a useUser composable that fetches API data to build the user: userInfo and companyInfo.
I get the error that a composable is used outside the Nuxt instance.
I want to know the best practices for implementing something like this, if anyone knows enough to help
Here's the code for the user composable and the user plugin.
composables/useUser.js
plugins/user-plugin.js
6 replies