Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: Nestjs Swagger don't render the page #1709

Open
Altro31 opened this issue Aug 10, 2024 · 1 comment
Open

[Bug Report]: Nestjs Swagger don't render the page #1709

Altro31 opened this issue Aug 10, 2024 · 1 comment

Comments

@Altro31
Copy link

Altro31 commented Aug 10, 2024

Steps to reproduce

  1. bun run dev
  2. open the browser and navigate to localhost:3000/api

Reproduce link

https://github.com/Altro31/farm-swagger.git

What is actually happening?

the swagger page don't get rendered

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (4) x64 AMD Athlon 200GE with Radeon Vega Graphics
    Memory: 10.47 GB / 21.92 GB
  Binaries:
    Node: 22.0.0 - D:\Dev\nodejs\node.EXE
    npm: 10.6.0 - D:\Dev\nodejs\npm.CMD
    pnpm: 8.14.1 - ~\AppData\Local\pnpm\pnpm.CMD
    bun: 1.1.21 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @farmfe/core: ^1.3.12 => 1.3.12
@shulandmimi
Copy link
Member

This is because @nestjs/swagger does not directly set the static resources related to swagger-ui-dist, but obtains them through the request path, but I did not see it in the @nestjs/swagger related tutorials, so this should be a feature (function) corresponding to some builder development, but we do not support this feature. You can temporarily avoid it in the following way. We will try to find a way to solve it later.

import * as express from 'express';

// ...
app.use(
    '/api',
    express.static(
      path.join(process.cwd(), 'node_modules', 'swagger-ui-dist'),
      {},
    ),
  );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants