Trailing slash redirect middleware for Connect and Express.js. Version 1.4.0 is the current stable release, with no predictable cadence. It automatically appends or removes trailing slashes from URLs to enforce canonical URLs. Unlike alternatives like `express-slash`, it uses 301 redirects by default and supports custom base paths and headers. It only affects GET, HEAD, and OPTIONS requests to avoid data loss on POST/PUT.
npm install connect-slashesVerified import paths — ran on the pinned version, not inferred.
Sets up an Express server that appends trailing slashes to URLs under /blog, using 301 redirects with custom headers.
Order middleware correctly: static first, then slashes.
This is intentional; no fix needed.
Pass { code: 302 } as second argument to slashes() for temporary redirects.Set the `base` option correctly, e.g., { base: '/blog' }.Run `npm install connect-slashes` in your project directory.
Use `import slashes from 'connect-slashes'` or `const slashes = require('connect-slashes')`.Move slashes middleware after static middleware in the middleware stack.
No dependency data recorded yet.