feat: entire application
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { DiscoveryService, MetadataScanner, Reflector } from '@nestjs/core';
|
||||
|
||||
export interface NavItem {
|
||||
path: string;
|
||||
label: string;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class NavigationService {
|
||||
constructor(
|
||||
private readonly discovery: DiscoveryService,
|
||||
private readonly metadataScanner: MetadataScanner,
|
||||
private readonly reflector: Reflector,
|
||||
) {}
|
||||
|
||||
private isGetMethod(handler: (...args: any[]) => any): boolean {
|
||||
return Reflect.getMetadata('method', handler) === 'GET';
|
||||
}
|
||||
|
||||
getNavigationItems(currentPath: string = '/'): NavItem[] {
|
||||
const navItems: NavItem[] = [
|
||||
{
|
||||
path: '/',
|
||||
label: 'Home',
|
||||
active: currentPath === '/',
|
||||
},
|
||||
{
|
||||
path: '/cats',
|
||||
label: 'Cats',
|
||||
active: currentPath === '/cats',
|
||||
},
|
||||
];
|
||||
|
||||
return navItems;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user