Skip to content

Commit 4a2e5cc

Browse files
authored
docs(server): document ignoreTrailingSlash (#1633)
1 parent 92ffbf5 commit 4a2e5cc

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

docs/_api/server.md

+4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ routes and handlers for incoming requests.
7373
ciphers; however these can all be specified on httpsServerOptions.
7474
- `options.strictRouting` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If set, Restify
7575
will treat "/foo" and "/foo/" as different paths. (optional, default `false`)
76+
- `options.ignoreTrailingSlash` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** ignore trailing slash
77+
on paths (optional, default `false`)
7678

7779
**Examples**
7880

@@ -133,6 +135,8 @@ Creates a new Server.
133135
ciphers; however these can all be specified on httpsServerOptions.
134136
- `options.noWriteContinue` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** prevents
135137
`res.writeContinue()` in `server.on('checkContinue')` when proxing (optional, default `false`)
138+
- `options.ignoreTrailingSlash` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** ignore trailing slash
139+
on paths (optional, default `false`)
136140

137141
**Examples**
138142

docs/guides/6to7guide.md

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ The new version of restify never returns `RequestAbortedError`.
2525
Option `strictRouting` is removed `createServer({ strictRouting: false })`.
2626
Strict routing is the new default.
2727

28+
### Path trailing slash at the end
29+
30+
`/path` and `/path/` are not the same thing in restify `v7.x`.
31+
Use `ignoreTrailingSlash: true` server option if you don't want to differentiate
32+
them from each other.
33+
2834
### Different `RegExp` usage in router path and wildcards
2935

3036
restify's new router backend

lib/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ require('./errorTypes');
5555
* ciphers; however these can all be specified on httpsServerOptions.
5656
* @param {Boolean} [options.strictRouting=false] - If set, Restify
5757
* will treat "/foo" and "/foo/" as different paths.
58+
* @param {Boolean} [options.ignoreTrailingSlash=false] - ignore trailing slash
59+
* on paths
5860
* @example
5961
* var restify = require('restify');
6062
* var server = restify.createServer();

lib/router.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ var ResourceNotFoundError = errors.ResourceNotFoundError;
3333
* @param {Boolean} [options.strictNext=false] - Throws error when next() is
3434
* called more than once, enabled onceNext option
3535
* @param {Object} [options.registry] - route registry
36-
* @param {Object} [options.ignoreTrailingSlash] - ignore trailing slash on
37-
* paths
36+
* @param {Boolean} [options.ignoreTrailingSlash=false] - ignore trailing slash
37+
* on paths
3838
*/
3939
function Router(options) {
4040
assert.object(options, 'options');

lib/server.js

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ var PROXY_EVENTS = [
9090
* ciphers; however these can all be specified on httpsServerOptions.
9191
* @param {Boolean} [options.noWriteContinue=false] - prevents
9292
* `res.writeContinue()` in `server.on('checkContinue')` when proxing
93+
* @param {Boolean} [options.ignoreTrailingSlash=false] - ignore trailing slash
94+
* on paths
9395
* @example
9496
* var restify = require('restify');
9597
* var server = restify.createServer();

0 commit comments

Comments
 (0)