Skip to content

Commit

Permalink
fix: external api document spec url (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
h4l-yup authored Jan 15, 2024
1 parent 1bd7292 commit ec1c2e0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/api/src/domains/external/external.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
import { Controller, Get, Res } from '@nestjs/common';
import { Controller, Get, Req, Res } from '@nestjs/common';
import { ApiExcludeController } from '@nestjs/swagger';
import { FastifyReply } from 'fastify';
import { FastifyReply, FastifyRequest } from 'fastify';

@Controller('/external')
@ApiExcludeController()
export class ExternalController {
constructor() {}

@Get('docs')
getExternalDocs(@Res() reply: FastifyReply): void {
getExternalDocs(
@Req() request: FastifyRequest,
@Res() reply: FastifyReply,
): void {
const host = request.hostname;
const html = `<!DOCTYPE html>
<html>
<head>
Expand All @@ -44,7 +48,7 @@ export class ExternalController {
</style>
</head>
<body>
<redoc spec-url='http://localhost:4000/external-docs-json'></redoc>
<redoc spec-url='http://${host}/external-docs-json'></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
</body>
</html>`;
Expand Down

0 comments on commit ec1c2e0

Please sign in to comment.