nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
66.9k stars 7.55k forks source link

'version' specification is not working in global prefix excluded routes #12928

Closed MortezaHeydari97 closed 9 months ago

MortezaHeydari97 commented 9 months ago

Is there an existing issue for this?

Current behavior

Hi, I think I'm faced a bug or maybe I'm wrong.

I wanna exclude some routes with specific version.

Minimum reproduction code

https://stackblitz.com/edit/nestjs-typescript-starter-unvvg1

Steps to reproduce

No response

Expected behavior

I was expected version in setGlobalPrefix will specifically excludes auth routes with admin version.

Package

Other package

No response

NestJS version

10.2.10

Packages versions


{
  "name": "my-app-name",
  "version": "0.1.0",
  "description": "some desc",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch --tsc",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@fastify/helmet": "^11.1.1",
    "@fastify/static": "^6.12.0",
    "@fastify/view": "^8.2.0",
    "@nestjs/axios": "^3.0.1",
    "@nestjs/common": "^10.2.10",
    "@nestjs/config": "^3.1.1",
    "@nestjs/core": "^10.2.10",
    "@nestjs/jwt": "^10.2.0",
    "@nestjs/mapped-types": "2.0.4",
    "@nestjs/passport": "^10.0.3",
    "@nestjs/platform-fastify": "^10.2.10",
    "@nestjs/schedule": "^4.0.0",
    "@nestjs/throttler": "^5.1.0",
    "@nestjs/typeorm": "^10.0.1",
    "@nextnm/nestjs-mailgun": "^3.0.1",
    "bcrypt": "^5.1.1",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "handlebars": "^4.7.8",
    "handlebars-layouts": "^3.1.4",
    "moment": "^2.29.4",
    "mysql2": "^3.6.5",
    "passport": "^0.7.0",
    "passport-jwt": "^4.0.1",
    "passport-local": "^1.0.0",
    "reflect-metadata": "^0.2.1",
    "rimraf": "^5.0.5",
    "rxjs": "^7.8.1"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.2.1",
    "@nestjs/schematics": "^10.0.3",
    "@nestjs/testing": "^10.2.10",
    "@types/bcrypt": "^5.0.2",
    "@types/cron": "^2.4.0",
    "@types/jest": "29.5.11",
    "@types/node": "^20.10.4",
    "@types/passport-jwt": "^3.0.13",
    "@types/passport-local": "^1.0.38",
    "@types/supertest": "^2.0.16",
    "@typescript-eslint/eslint-plugin": "^6.14.0",
    "@typescript-eslint/parser": "^6.14.0",
    "eslint": "^8.56.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.0.1",
    "jest": "29.7.0",
    "prettier": "^3.1.1",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "29.1.1",
    "ts-loader": "^9.5.1",
    "ts-node": "^10.9.2",
    "tsconfig-paths": "4.2.0",
    "typescript": "^5.3.3"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

Node.js version

20.9.0

In which operating systems have you tested?

Other

I appreciate to help me clear the subject I'm wrong or it's a bug !

kamilmysliwiec commented 9 months ago

Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the #⁠ 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.