ts: lib/middleware/redirectWithoutTrailingSlashes.js

Signed-off-by: Raccoon <raccoon@hackmd.io>
This commit is contained in:
Raccoon 2021-06-12 05:19:21 +08:00
parent 68439de268
commit cf630ede21
No known key found for this signature in database
GPG Key ID: 06770355DC9ECD38

View File

@ -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)