Skip to content

Commit d4ba0d7

Browse files
committed
Serve OpenAPI JSON without Fastify static assets
1 parent 42a8fce commit d4ba0d7

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The sample app is no longer a hello-world stub. It now includes:
8484
- `GET /health`: health status, uptime, and timestamp.
8585
- `GET /api/compute/presets`: sample payloads.
8686
- `POST /api/compute/plan`: validated compute planning endpoint with workload partitioning, execution recommendation, and preview checksum.
87-
- `GET /docs`: Swagger UI.
87+
- `GET /docs-json`: generated OpenAPI JSON.
8888

8989
Run it locally from the subdirectory:
9090

nestjs-fastify-boilerplate/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A Fastify-first NestJS starter with useful endpoints instead of the stock hello-
88
- `GET /health`: service status, uptime, and timestamp.
99
- `GET /api/compute/presets`: sample local and Modal payloads.
1010
- `POST /api/compute/plan`: validated workload planning endpoint.
11-
- `GET /docs`: Swagger UI.
11+
- `GET /docs-json`: generated OpenAPI JSON.
1212

1313
## Example request
1414

nestjs-fastify-boilerplate/src/app.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('AppController', () => {
2020

2121
expect(overview).toMatchObject({
2222
name: 'nestjs-fastify-boilerplate',
23-
docs: '/docs',
23+
docs: '/docs-json',
2424
});
2525
expect(overview.routes).toEqual(
2626
expect.arrayContaining([

nestjs-fastify-boilerplate/src/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AppService {
1010
description:
1111
'Fastify-first NestJS starter for health checks and Modal workload planning.',
1212
version: '0.1.0',
13-
docs: '/docs',
13+
docs: '/docs-json',
1414
routes: ['/health', '/api/compute/presets', '/api/compute/plan'],
1515
startedAt: this.startedAt.toISOString(),
1616
};

nestjs-fastify-boilerplate/src/configure-app.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ export function configureApp(app: NestFastifyApplication) {
2323
.addTag('compute')
2424
.build();
2525
const document = SwaggerModule.createDocument(app, config);
26-
SwaggerModule.setup('docs', app, document);
26+
27+
app.getHttpAdapter().getInstance().get('/docs-json', async (_request, reply) => {
28+
return reply.send(document);
29+
});
2730
}

0 commit comments

Comments
 (0)