JSPM

slashify

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 335
  • Score
    100M100P100Q88726F
  • License MIT

Express/Connect middleware to handle trailing slashes with options

Package Exports

  • slashify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (slashify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

slashify

Express/Connect middleware to handle trailing slashes with options.

Why?

Why another remove trailing slash middleware? Because we wanted options. Like leaving the slash when serving the index file of a directory and custom index file names, etc!

Install

npm install slashify --save

Usage

var express = require('express');
var slashify = require('slashify');

var app = express();

app.use(slashify());

app.listen(3000, function () {
  
});

slashify([options])

  • options
    • root - the root directory. This is mostly used when you have a directory handling turned on and/or have custom index file names. Defaults to ./
    • index - the name of the directory index file. Defaults to index.html.
    • directory - set whether or not you want slashify to leave the trailing slash when serving the index file of a directory. Defaults to true. Set to false to remove the trailing slash for all paths.

Run Tests

npm install
npm test