mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge pull request #33193 from mgroenhoff/express-urlrewrite
Add typings for express-urlrewrite
This commit is contained in:
@@ -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);
|
||||
Vendored
+12
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user