refactor(server): remove api prefix for all routes

This commit is contained in:
Amruth Pillai 2022-03-08 10:52:13 +01:00
parent 5a2594eb88
commit 43ce43ab5b
No known key found for this signature in database
GPG Key ID: E3C57DF9B80855AD
3 changed files with 2 additions and 6 deletions

View File

@ -20,7 +20,7 @@ const nextConfig = {
return [
{
source: '/api/:path*',
destination: 'http://localhost:3100/api/:path*',
destination: 'http://localhost:3100/:path*',
},
];
}

View File

@ -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<Resume>(`${prefix}/resume/${username}/${slug}`, requestOptions).then((res) => res.data);

View File

@ -9,10 +9,6 @@ import { AppModule } from './app.module';
const bootstrap = async () => {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
// Prefix
const globalPrefix = 'api';
app.setGlobalPrefix(globalPrefix);
// Middleware
app.enableShutdownHooks();
app.use(cookieParser());