1.1.1 • Published 6 years ago
unslash v1.1.1
unslash
Connect/Express middleware that removes trailing slashes from URLs, redirecting the request.
Install
$ npm install --save unslash
Usage
Set unslash as a middleware before the routes you want redirected.
import express from 'express'
import unslash from 'unslash'
const app = express()
// Use unslash with default options
app.use(unslash)
// Use unslash with a specific status
app.use(unslash({ status: 302 }))
Options
status
Set the HTTP status of the redirection. The default value is 301
.
methods
An array containing the HTTP methods that should be redirected. The default value is ['GET', 'HEAD']
.