Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Slash redirects for Connect
JavaScript
Branch: master
Pull request Compare This branch is 39 commits behind avinoamr:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
README.md
index.js
package.json

README.md

connect-slashes

Trailing slash redirect middleware for Connect. Useful for creating canonical urls in your Node.js applications.

Installation

$ npm install connect-slashes

Usage

var connect = require('connect')
  , slashes = require('connect-slashes');

connect()
  .use(connect.logger())
  .use(connect.static())
  .use(slashes())
  .listen(3000); 

Notes

  1. Only GET requests will be redirected (to avoid losing POST/PUT data)
  2. This middleware will append a trailing slash to all request urls. This includes filenames (/app.css => /app.css/), so it may break your static files. Make sure to .use() this middleware only after the connect.static() middleware.
Something went wrong with that request. Please try again.