cc-core-cli
Version:
Command Line Interface tool for generating project templates for the (Your Platform's Name) platform.
40 lines (34 loc) • 992 B
text/typescript
import * as _ from "lodash";
import { Controller, Get, Param } from "@nestjs/common";
import { AppService } from "./app.service";
import { Public, CONST } from "@shopstack/cc-core-lib/core";
export class AppController {
constructor(private readonly appService: AppService) { }
healthCheck(): boolean {
return this.appService.healthCheck();
}
init(): string {
return this.appService.init();
}
listAllRoutes( params: any): any {
const { method, entity } = params;
if (_.isEmpty(method)) {
return [];
}
const result = CONST.ENDPOINT_PATHS.filter(
p => p.method.toLowerCase() === method.toLowerCase()
);
if (_.isEmpty(entity) || entity === "undefined") {
return result;
}
return result.filter(
r => r.path.indexOf(entity) === 0 || r.path.indexOf(":entity") === 0
);
}
}