UNPKG

nralcm

Version:

This is a framework based on NodeJs to manage rest api request lifecycle

21 lines (20 loc) 719 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const functions_1 = require("../common/functions"); /** * Decorator for rest api controller. * Every Controller must decorate with this decorator */ function Controller() { return function (target) { const targetString = target.toString(); const baseControllerIndex = targetString.indexOf("BaseController"); if (baseControllerIndex > 0 && targetString.indexOf("BaseController") < targetString.indexOf("{")) { functions_1.IsInjectable(target); } else { throw new Error(`${target.name} must extend with BaseController`); } }; } exports.Controller = Controller;