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

feat: [NestJS] Fastify global prefix support #704

Merged
merged 3 commits into from
Mar 24, 2024

Conversation

dimbslmh
Copy link
Contributor

@dimbslmh dimbslmh commented Mar 21, 2024

Fixes #607.

Apparently #592 doesn't work with Fastify and #639 adds Fastify support.
But both PRs fail loading the static folder correctly when global prefix doesn't start with a forward slash.
It was mentioned here #592 (comment) with #607 (comment) as the solution.

This PR does 2 things:

  1. Makes sure that there is a leading forward slash in the adapter.basePath to correctly load the static folder for both Express and Fastify.
  2. Fastify prefix option should be equal to the adapter.basePath.

I've setup 2 codesandboxes for you to verify this PR:

NestJS + Express: https://codesandbox.io/p/devbox/vigilant-tdd-nhjg2r
Preview: https://nhjg2r-3000.csb.app/api/queues

NestJS + Fastify: https://codesandbox.io/p/devbox/naughty-kepler-w38fhq
Preview: https://w38fhq-3000.csb.app/api/queues

  • main.ts: You can change the global prefix here with/without a leading slash. Or comment out the setGlobalPrefix method to see that it still works without it.

  • app.module.ts: Change the route to something else if you want.

Both use "@bull-board/nestjs": "github:dimbslmh/bull-board-nestjs",

@dimbslmh dimbslmh changed the title fix: [NestJS] Prefix requires a leading forward slash to load static folder correctly fix: Prefix requires a leading forward slash to load static folder correctly label:Nest.js Mar 21, 2024
@dimbslmh dimbslmh changed the title fix: Prefix requires a leading forward slash to load static folder correctly label:Nest.js feat: [NestJS] Fastify global prefix support Mar 22, 2024
@dimbslmh dimbslmh mentioned this pull request Mar 22, 2024
packages/nestjs/src/bull-board.root-module.ts Outdated Show resolved Hide resolved
@felixmosh felixmosh merged commit 04f07b2 into felixmosh:master Mar 24, 2024
@dimbslmh dimbslmh deleted the fix-607 branch March 24, 2024 12:32
@felixmosh
Copy link
Owner

Thank you for this PR,
This released in v5.15.2

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

Successfully merging this pull request may close these issues.

global prefix doesn't work
2 participants