项目作者: bcruddy

项目描述 :
Express middleware to force no trailing slash in the URL
高级语言: JavaScript
项目地址: git://github.com/bcruddy/no-slash.git
创建时间: 2017-04-26T04:01:10Z
项目社区:https://github.com/bcruddy/no-slash

开源协议:MIT License

下载


npm version
Build Status

no-slash

Express middleware for forcing no trailing url slash via redirect.
Defaults to a 301, status code can be passed as an argument.

Usage

  • node 6+ recommended, for node < 6, an ES5 module is available at lib/es5.js.
  • $ yarn add no-slash or $ npm install no-slash --save
  1. const express = require('express'),
  2. noSlash = require('no-slash'),
  3. app = express();
  4. app.use(noSlash());

Or for node < 6

  1. var express = require('express'),
  2. noSlash = require('no-slash/lib/es5'),
  3. app = express();
  4. app.use(noSlash());

Contributing

Feel free to fork and submit a PR. Please reference an issue in your PR to simplify tracking them (create one if it doesn’t exist, feature or bug).

  • node v8, npm v5
  • Tests are run with jest, 100% coverage is required
  • Linting with eslint
  • TravisCI for deploy to npm