Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-slashes

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-slashes

Trailing slash redirect middleware for Connect

  • 0.0.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-11.39%
Maintainers
1
Weekly downloads
 
Created
Source

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

Alternatively, you can pass false as the only argument to .slashes() in order to remove trailing slashes instead of appending them:

.use(slashes(false));

Notes

  1. Only GET requests will be redirected (to avoid losing POST/PUT data)
  2. This middleware will append or removes 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.

Keywords

FAQs

Package last updated on 27 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc