Merge pull request #12670 from ligaz/express-router-options

[express] Add Router constructor options
This commit is contained in:
Andy
2016-11-15 06:50:52 -08:00
committed by GitHub
2 changed files with 23 additions and 3 deletions
+1 -2
View File
@@ -29,8 +29,7 @@ namespace express_tests {
res.send('hello world');
});
const router = express.Router();
const router = express.Router({ caseSensitive: true, mergeParams: true, strict: true });
const pathStr: string = 'test';
const pathRE: RegExp = /test/;
+22 -1
View File
@@ -28,7 +28,28 @@ declare namespace e {
*/
var static: typeof serveStatic;
export function Router(options?: any): core.Router;
export function Router(options?: RouterOptions): core.Router;
interface RouterOptions {
/**
* Enable case sensitivity.
*/
caseSensitive?: boolean;
/**
* Preserve the req.params values from the parent router.
* If the parent and the child have conflicting param names, the child’s value take precedence.
*
* @default false
* @since 4.5.0
*/
mergeParams?: boolean;
/**
* Enable strict routing.
*/
strict?: boolean;
}
interface Application extends core.Application { }
interface CookieOptions extends core.CookieOptions { }