Merge pull request #33193 from mgroenhoff/express-urlrewrite

Add typings for express-urlrewrite
This commit is contained in:
Andrew Casey
2019-02-20 13:37:52 -08:00
committed by GitHub
4 changed files with 58 additions and 0 deletions
@@ -0,0 +1,22 @@
import * as express from "express";
import rewrite = require("express-urlrewrite");
declare const app: express.Application;
app.use(rewrite(/^\/i(\w+)/, "/items/$1"));
app.use(rewrite("/:src..:dst", "/commits/$1/to/$2"));
app.use(rewrite("/:src..:dst", "/commits/:src/to/:dst"));
app.use(rewrite("/js/*", "/public/assets/js/$1"));
app.use(rewrite("/file\\?param=:param", "/file/:param"));
app.use(rewrite("/path", "/anotherpath?param=some"));
app.get("/route/:var", rewrite("/rewritten/:var"));
declare const someMw: express.Handler;
app.get("/rewritten/:var", someMw);
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for express-urlrewrite 1.2
// Project: https://github.com/kapouer/express-urlrewrite
// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as express from "express";
declare function rewrite(s: string): express.Handler;
declare function rewrite(s: string | RegExp, t: string): express.Handler;
export = rewrite;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-urlrewrite-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }