From 43ce43ab5b37e93bc9b3378abd01913455d5f0ce Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Tue, 8 Mar 2022 10:52:13 +0100 Subject: [PATCH] refactor(server): remove api prefix for all routes --- client/next.config.js | 2 +- client/services/resume.ts | 2 +- server/src/main.ts | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/client/next.config.js b/client/next.config.js index fa73440b..6c7e4615 100644 --- a/client/next.config.js +++ b/client/next.config.js @@ -20,7 +20,7 @@ const nextConfig = { return [ { source: '/api/:path*', - destination: 'http://localhost:3100/api/:path*', + destination: 'http://localhost:3100/:path*', }, ]; } diff --git a/client/services/resume.ts b/client/services/resume.ts index 9be37e43..c60274c2 100644 --- a/client/services/resume.ts +++ b/client/services/resume.ts @@ -71,7 +71,7 @@ export const fetchResumeByIdentifier = async ({ slug, options = { secretKey: '' }, }: FetchResumeByIdentifierParams) => { - const prefix = !isBrowser && process.env.NODE_ENV === 'development' ? 'http://localhost:3100/api' : ''; + const prefix = !isBrowser && process.env.NODE_ENV === 'development' ? 'http://localhost:3100' : ''; const requestOptions = isEmpty(options.secretKey) ? {} : { params: { secretKey: options.secretKey } }; return axios.get(`${prefix}/resume/${username}/${slug}`, requestOptions).then((res) => res.data); diff --git a/server/src/main.ts b/server/src/main.ts index 9928eff6..a1366e87 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -9,10 +9,6 @@ import { AppModule } from './app.module'; const bootstrap = async () => { const app = await NestFactory.create(AppModule); - // Prefix - const globalPrefix = 'api'; - app.setGlobalPrefix(globalPrefix); - // Middleware app.enableShutdownHooks(); app.use(cookieParser());