diff --git a/backend/src/fastify.ts b/backend/src/fastify.ts index 7a1682f..ab2db3a 100644 --- a/backend/src/fastify.ts +++ b/backend/src/fastify.ts @@ -15,6 +15,10 @@ export const startupFastifyServer = async (): Promise => { logger: false, }); + fastify.addHook("onRoute", (routeOptions) => { + routeOptions.url = `/api${routeOptions.url}`; + }); + fastify.register(fastifySensible); fastify.register(fastifyMultipart); fastify.register(FastifySSEPlugin); diff --git a/backend/src/services/user/routes.ts b/backend/src/services/user/routes.ts index 4455c03..c265708 100644 --- a/backend/src/services/user/routes.ts +++ b/backend/src/services/user/routes.ts @@ -7,12 +7,9 @@ export const userService = fastifyPlugin( fastify.get("/me", { onRequest: [fastify.authenticate], handler: async (request: FastifyRequest, reply) => { - console.log("using mongo uri", container.cradle.connectionString); const userService = container.cradle.userService; const requestUser = request.user; const user = await userService.findById(requestUser._id); - - console.log("user", user); if (!user) { throw new Error(`User not found with id ${requestUser._id}`); } diff --git a/frontend/.env.development b/frontend/.env.development index 1dbd38f..0eb6119 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -1 +1 @@ -VITE_BACKEND_URL=http://127.0.0.1:5174 +VITE_BACKEND_URL=http://127.0.0.1:5174/api diff --git a/frontend/.env.production b/frontend/.env.production index 1d2d7a1..d3f9829 100644 --- a/frontend/.env.production +++ b/frontend/.env.production @@ -1 +1 @@ -VITE_BACKEND_URL=http://0.0.0.0:5174 +VITE_BACKEND_URL=http://0.0.0.0:5174/api diff --git a/frontend/src/hooks/userUserData.ts b/frontend/src/hooks/userUserData.ts index bc5dd5b..a28a7e5 100644 --- a/frontend/src/hooks/userUserData.ts +++ b/frontend/src/hooks/userUserData.ts @@ -22,7 +22,7 @@ export const useUserData = (): { const { data, error, isLoading } = useSWR( `${import.meta.env.VITE_BACKEND_URL}/me`, fetcher, - { refreshInterval: 10000 } + { refreshInterval: 1000 } ); return { userData: data,