Comparing version 1.0.3 to 1.0.4
@@ -19,2 +19,3 @@ import * as Express from "express"; | ||
} | ||
export declare let globalKCState: KwyjiboControllersState; | ||
/********************************************************* | ||
@@ -28,3 +29,3 @@ * Class Decorators | ||
*/ | ||
export declare function Controller<T>(mountpoint?: string | KwyjiboControllerConstructor<T>, path?: string): (Function) => void; | ||
export declare function Controller<T>(mountpoint?: string | KwyjiboControllerConstructor<T>, path?: string): (f: Function) => void; | ||
/** | ||
@@ -34,11 +35,11 @@ * Adds express middleware to run before mounting the controller | ||
*/ | ||
export declare function Middleware(...middleware: Express.RequestHandler[]): (Function) => void; | ||
export declare function Middleware(...middleware: Express.RequestHandler[]): (f: Function) => void; | ||
/** | ||
* @param { boolean } condition - Only mounts this controller if condition is true. | ||
*/ | ||
export declare function MountCondition(condition: boolean): (Function) => void; | ||
export declare function MountCondition(condition: boolean): (f: Function) => void; | ||
/** | ||
* Only mounts this controller if NODE_ENV is set to "development" | ||
*/ | ||
export declare function Dev(): (Function) => void; | ||
export declare function Dev(): (f: Function) => void; | ||
/** | ||
@@ -48,13 +49,13 @@ * Attach a documentation string to the controller | ||
*/ | ||
export declare function DocController(docStr: string): (Function) => void; | ||
export declare function DocController(docStr: string): (f: Function) => void; | ||
/** | ||
* Generate test runner paths inside this controller | ||
*/ | ||
export declare function TestRunner(): (Function) => void; | ||
export declare function TestRunner(): (f: Function) => void; | ||
/********************************************************* | ||
* Method Decorators | ||
*********************************************************/ | ||
export declare function Method(method: string, path?: string): (any, string, PropertyDescriptor) => void; | ||
export declare function Get(path?: string): (any, string, PropertyDescriptor) => void; | ||
export declare function Post(path?: string): (any, string, PropertyDescriptor) => void; | ||
export declare function Method(method: string, path?: string): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
export declare function Get(path?: string): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
export declare function Post(path?: string): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/** | ||
@@ -64,7 +65,7 @@ * Adds express middleware to run before the method | ||
*/ | ||
export declare function ActionMiddleware(...middleware: Express.RequestHandler[]): (any, string, PropertyDescriptor) => void; | ||
export declare function ActionMiddleware(...middleware: Express.RequestHandler[]): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/** | ||
* Flags the method as "Express Compatible" and thus will be called with parameters (req,res,next) | ||
*/ | ||
export declare function ExpressCompatible(): (any, string, PropertyDescriptor) => void; | ||
export declare function ExpressCompatible(): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/** | ||
@@ -74,3 +75,3 @@ * Attach a documentation string to the method | ||
*/ | ||
export declare function DocAction(docStr: string): (any, string, PropertyDescriptor) => void; | ||
export declare function DocAction(docStr: string): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/********************************************************* | ||
@@ -155,3 +156,2 @@ * Method Parameters Decorators | ||
} | ||
export declare let globalKCState: KwyjiboControllersState; | ||
export declare function addControllersToExpressApp(app: Express.Application, rootPath?: string): void; |
@@ -349,13 +349,18 @@ "use strict"; | ||
if (basePath.substring(basePath.length - 1) === "/") { | ||
basePath = basePath.substr(0, basePath.length - 1); | ||
basePath = basePath.trim().substr(0, basePath.length - 1); | ||
} | ||
let strictPath = U.UrlJoin(basePath, "/"); | ||
baseRouter.use(strictPath, (req, res, next) => { | ||
if (req.originalUrl.substring(req.originalUrl.length - basePath.length) === basePath) { | ||
res.redirect(strictPath); | ||
} | ||
else { | ||
next(); | ||
} | ||
}, router); | ||
if (strictPath !== "/") { | ||
baseRouter.use(strictPath, (req, res, next) => { | ||
if (req.originalUrl.substring(req.originalUrl.length - basePath.length) === basePath) { | ||
res.redirect(strictPath); | ||
} | ||
else { | ||
next(); | ||
} | ||
}, router); | ||
} | ||
else { | ||
baseRouter.use(strictPath, router); | ||
} | ||
} | ||
@@ -406,1 +411,2 @@ function createRouterRecursive(app, controllerNode) { | ||
exports.addControllersToExpressApp = addControllersToExpressApp; | ||
//# sourceMappingURL=controller.js.map |
"use strict"; | ||
//# sourceMappingURL=documentation.js.map |
@@ -8,1 +8,2 @@ "use strict"; | ||
__export(require("./utils")); | ||
//# sourceMappingURL=index.js.map |
import * as C from "./controller"; | ||
export declare let globalKTState: KwyjiboTestsState; | ||
/********************************************************* | ||
@@ -9,3 +10,3 @@ * Class Decorators | ||
*/ | ||
export declare function Fixture(humanReadableName?: string): (Function) => void; | ||
export declare function Fixture(humanReadableName?: string): (f: Function) => void; | ||
/********************************************************* | ||
@@ -18,11 +19,11 @@ * Method Decorators | ||
*/ | ||
export declare function Test(humanReadableName: string): (any, string, PropertyDescriptor) => void; | ||
export declare function Test(humanReadableName: string): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/** | ||
* Method to run before any of the tests. | ||
*/ | ||
export declare function Before(): (any, string, PropertyDescriptor) => void; | ||
export declare function Before(): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/** | ||
* Method to run after any of the tests. | ||
*/ | ||
export declare function After(): (any, string, PropertyDescriptor) => void; | ||
export declare function After(): (a: any, s: string, pd: PropertyDescriptor) => void; | ||
/********************************************************* | ||
@@ -66,3 +67,2 @@ * Tests | ||
} | ||
export declare let globalKTState: KwyjiboTestsState; | ||
export declare function injectTestRunnerMiddleware(controller: C.KwyjiboController): void; |
@@ -409,1 +409,2 @@ "use strict"; | ||
exports.injectTestRunnerMiddleware = injectTestRunnerMiddleware; | ||
//# sourceMappingURL=testing.js.map |
@@ -18,1 +18,2 @@ "use strict"; | ||
exports.defaultLog = (str) => { console.log(str); }; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "kwyjibo", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A set of Typescript Decorators and helpers to write better node.js+Express applications.", | ||
@@ -5,0 +5,0 @@ "main": "js/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65369
17
1044