Gathering detailed insights and metrics for @nestjsx/api-version
Gathering detailed insights and metrics for @nestjsx/api-version
Gathering detailed insights and metrics for @nestjsx/api-version
Gathering detailed insights and metrics for @nestjsx/api-version
npm install @nestjsx/api-version
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
34 Stars
2 Commits
1 Forks
1 Branches
1 Contributors
Updated on 30 Dec 2023
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
3
Compared to previous day
Last week
90%
19
Compared to previous week
Last month
59.2%
78
Compared to previous month
Last year
-39.1%
1,068
Compared to previous year
1
@nestjsx/api-verion
has been designed to quickly help you with the access logic if you're using global prefix
in your application and want to restrict an access to different API endpoints with different API versions. For now it works with Express
and Fastify
adapters.
1npm i @nestjsx/api-version --save
global prefix
in your bootstrap file1import { NestFactory } from '@nestjs/core'; 2import { ApplicationModule } from './app.module'; 3 4async function bootstrap() { 5 const app = await NestFactory.create(ApplicationModule); 6 app.setGlobalPrefix('v1'); // <-- here 7 await app.listen(3000); 8} 9bootstrap();
ApiVersionGuard
in app module1import { ApiVersionGuard } from '@nestjsx/api-version'; 2import { Module } from '@nestjs/common'; 3import { APP_GUARD } from '@nestjs/core'; 4 5@Module({ 6 providers: [ 7 { 8 provide: APP_GUARD, 9 useClass: ApiVersionGuard, 10 }, 11 ], 12}) 13export class ApplicationModule {}
ApiVersion
decorator in your controller1import { ApiVersion } from '@nestjsx/api-version'; 2import { Controller, Get } from '@nestjs/common'; 3 4@Controller('cats') 5export class CatsController { 6 @Get() 7 @ApiVersion() 8 findAllV1() { 9 return 'This action will work in all versions'; 10 } 11 12 @Get() 13 @ApiVersion('v1') 14 findAllV1() { 15 return 'This action will work in v1 version'; 16 } 17 18 @Get() 19 @ApiVersion('v2') 20 findAllNext() { 21 return 'This action will work in v2 version only'; 22 } 23}
1npm run test:e2e
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/2 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
83 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More