refactor api

This commit is contained in:
2024-10-13 18:07:13 +07:00
parent 263ff4e207
commit 1f86786e1a
7 changed files with 29 additions and 9 deletions

View File

@@ -13,6 +13,9 @@ async function bootstrap() {
credentials: true,
});
// set base path for api
app.setGlobalPrefix(process.env.API_PATH ?? '/v1');
const config = new DocumentBuilder()
.setTitle('EPESS API')
.setDescription('API documentation for EPESS application')
@@ -22,9 +25,13 @@ async function bootstrap() {
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup(process.env.SWAGGER_PATH ?? 'v1', app, document);
console.log(process.env.API_PATH);
document.paths['/graphql'] = {
document.paths[process.env.API_PATH + '/graphql'] = {
get: {
tags: ['GraphQL'],
summary: 'GraphQL Playground',
description:
'Access the GraphQL Playground to interact with the GraphQL API.',