From cf630ede21c46f33a0a0b98601452aaed13dc65d Mon Sep 17 00:00:00 2001 From: Raccoon Date: Sat, 12 Jun 2021 05:19:21 +0800 Subject: [PATCH] ts: lib/middleware/redirectWithoutTrailingSlashes.js Signed-off-by: Raccoon --- ...TrailingSlashes.js => redirectWithoutTrailingSlashes.ts} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename lib/middleware/{redirectWithoutTrailingSlashes.js => redirectWithoutTrailingSlashes.ts} (74%) diff --git a/lib/middleware/redirectWithoutTrailingSlashes.js b/lib/middleware/redirectWithoutTrailingSlashes.ts similarity index 74% rename from lib/middleware/redirectWithoutTrailingSlashes.js rename to lib/middleware/redirectWithoutTrailingSlashes.ts index 456e3e30..6412e5d3 100644 --- a/lib/middleware/redirectWithoutTrailingSlashes.js +++ b/lib/middleware/redirectWithoutTrailingSlashes.ts @@ -1,8 +1,8 @@ -'use strict' +import {Request, Response} from "express"; -const config = require('../config') +import * as config from "../config"; -module.exports = function (req, res, next) { +export = function (req: Request, res: Response, next) { if (req.method === 'GET' && req.path.substr(-1) === '/' && req.path.length > 1) { const queryString = req.url.slice(req.path.length) const urlPath = req.path.slice(0, -1)