mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 16:51:33 +10:00
refactor(server): remove api prefix for all routes
This commit is contained in:
@ -20,7 +20,7 @@ const nextConfig = {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/api/:path*',
|
source: '/api/:path*',
|
||||||
destination: 'http://localhost:3100/api/:path*',
|
destination: 'http://localhost:3100/:path*',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ export const fetchResumeByIdentifier = async ({
|
|||||||
slug,
|
slug,
|
||||||
options = { secretKey: '' },
|
options = { secretKey: '' },
|
||||||
}: FetchResumeByIdentifierParams) => {
|
}: 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 } };
|
const requestOptions = isEmpty(options.secretKey) ? {} : { params: { secretKey: options.secretKey } };
|
||||||
|
|
||||||
return axios.get<Resume>(`${prefix}/resume/${username}/${slug}`, requestOptions).then((res) => res.data);
|
return axios.get<Resume>(`${prefix}/resume/${username}/${slug}`, requestOptions).then((res) => res.data);
|
||||||
|
|||||||
@ -9,10 +9,6 @@ import { AppModule } from './app.module';
|
|||||||
const bootstrap = async () => {
|
const bootstrap = async () => {
|
||||||
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
||||||
|
|
||||||
// Prefix
|
|
||||||
const globalPrefix = 'api';
|
|
||||||
app.setGlobalPrefix(globalPrefix);
|
|
||||||
|
|
||||||
// Middleware
|
// Middleware
|
||||||
app.enableShutdownHooks();
|
app.enableShutdownHooks();
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
|
|||||||
Reference in New Issue
Block a user