Dockerfile actualizado con express js
This commit is contained in:
21
node_modules/path-to-regexp/LICENSE
generated
vendored
Normal file
21
node_modules/path-to-regexp/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
35
node_modules/path-to-regexp/Readme.md
generated
vendored
Normal file
35
node_modules/path-to-regexp/Readme.md
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# Path-to-RegExp
|
||||
|
||||
Turn an Express-style path string such as `/user/:name` into a regular expression.
|
||||
|
||||
**Note:** This is a legacy branch. You should upgrade to `1.x`.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var pathToRegexp = require('path-to-regexp');
|
||||
```
|
||||
|
||||
### pathToRegexp(path, keys, options)
|
||||
|
||||
- **path** A string in the express format, an array of such strings, or a regular expression
|
||||
- **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings.
|
||||
- **options**
|
||||
- **options.sensitive** Defaults to false, set this to true to make routes case sensitive
|
||||
- **options.strict** Defaults to false, set this to true to make the trailing slash matter.
|
||||
- **options.end** Defaults to true, set this to false to only match the prefix of the URL.
|
||||
|
||||
```javascript
|
||||
var keys = [];
|
||||
var exp = pathToRegexp('/foo/:bar', keys);
|
||||
//keys = ['bar']
|
||||
//exp = /^\/foo\/(?:([^\/]+?))\/?$/i
|
||||
```
|
||||
|
||||
## Live Demo
|
||||
|
||||
You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/).
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
146
node_modules/path-to-regexp/index.js
generated
vendored
Normal file
146
node_modules/path-to-regexp/index.js
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Expose `pathToRegexp`.
|
||||
*/
|
||||
|
||||
module.exports = pathToRegexp;
|
||||
|
||||
/**
|
||||
* Match matching groups in a regular expression.
|
||||
*/
|
||||
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
||||
|
||||
/**
|
||||
* Normalize the given path string,
|
||||
* returning a regular expression.
|
||||
*
|
||||
* An empty array should be passed,
|
||||
* which will contain the placeholder
|
||||
* key names. For example "/user/:id" will
|
||||
* then contain ["id"].
|
||||
*
|
||||
* @param {String|RegExp|Array} path
|
||||
* @param {Array} keys
|
||||
* @param {Object} options
|
||||
* @return {RegExp}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function pathToRegexp(path, keys, options) {
|
||||
options = options || {};
|
||||
keys = keys || [];
|
||||
var strict = options.strict;
|
||||
var end = options.end !== false;
|
||||
var flags = options.sensitive ? '' : 'i';
|
||||
var lookahead = options.lookahead !== false;
|
||||
var extraOffset = 0;
|
||||
var keysOffset = keys.length;
|
||||
var i = 0;
|
||||
var name = 0;
|
||||
var pos = 0;
|
||||
var backtrack = '';
|
||||
var m;
|
||||
|
||||
if (path instanceof RegExp) {
|
||||
while (m = MATCHING_GROUP_REGEXP.exec(path.source)) {
|
||||
if (m[0][0] === '\\') continue;
|
||||
|
||||
keys.push({
|
||||
name: m[1] || name++,
|
||||
optional: false,
|
||||
offset: m.index
|
||||
});
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
if (Array.isArray(path)) {
|
||||
// Map array parts into regexps and return their source. We also pass
|
||||
// the same keys and options instance into every generation to get
|
||||
// consistent matching groups before we join the sources together.
|
||||
path = path.map(function (value) {
|
||||
return pathToRegexp(value, keys, options).source;
|
||||
});
|
||||
|
||||
return new RegExp(path.join('|'), flags);
|
||||
}
|
||||
|
||||
path = path.replace(
|
||||
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
||||
function (match, slash, format, key, capture, star, optional, offset) {
|
||||
pos = offset + match.length;
|
||||
|
||||
if (match[0] === '\\') {
|
||||
backtrack += match;
|
||||
return match;
|
||||
}
|
||||
|
||||
if (match === '.') {
|
||||
backtrack += '\\.';
|
||||
extraOffset += 1;
|
||||
return '\\.';
|
||||
}
|
||||
|
||||
backtrack = slash || format ? '' : path.slice(pos, offset);
|
||||
|
||||
if (match === '*') {
|
||||
extraOffset += 3;
|
||||
return '(.*)';
|
||||
}
|
||||
|
||||
if (match === '/(') {
|
||||
backtrack += '/';
|
||||
extraOffset += 2;
|
||||
return '/(?:';
|
||||
}
|
||||
|
||||
slash = slash || '';
|
||||
format = format ? '\\.' : '';
|
||||
optional = optional || '';
|
||||
capture = capture ?
|
||||
capture.replace(/\\.|\*/, function (m) { return m === '*' ? '(.*)' : m; }) :
|
||||
(backtrack ? '((?:(?!/|' + backtrack + ').)+?)' : '([^/' + format + ']+?)');
|
||||
|
||||
keys.push({
|
||||
name: key,
|
||||
optional: !!optional,
|
||||
offset: offset + extraOffset
|
||||
});
|
||||
|
||||
var result = '(?:'
|
||||
+ format + slash + capture
|
||||
+ (star ? '((?:[/' + format + '].+?)?)' : '')
|
||||
+ ')'
|
||||
+ optional;
|
||||
|
||||
extraOffset += result.length - match.length;
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
// This is a workaround for handling unnamed matching groups.
|
||||
while (m = MATCHING_GROUP_REGEXP.exec(path)) {
|
||||
if (m[0][0] === '\\') continue;
|
||||
|
||||
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
||||
keys.splice(keysOffset + i, 0, {
|
||||
name: name++, // Unnamed matching groups must be consistently linear.
|
||||
optional: false,
|
||||
offset: m.index
|
||||
});
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
path += strict ? '' : path[path.length - 1] === '/' ? '?' : '/?';
|
||||
|
||||
// If the path is non-ending, match until the end or a slash.
|
||||
if (end) {
|
||||
path += '$';
|
||||
} else if (path[path.length - 1] !== '/') {
|
||||
path += lookahead ? '(?=/|$)' : '(?:/|$)';
|
||||
}
|
||||
|
||||
return new RegExp('^' + path, flags);
|
||||
};
|
30
node_modules/path-to-regexp/package.json
generated
vendored
Normal file
30
node_modules/path-to-regexp/package.json
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "path-to-regexp",
|
||||
"description": "Express style path to RegExp utility",
|
||||
"version": "0.1.10",
|
||||
"files": [
|
||||
"index.js",
|
||||
"LICENSE"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "istanbul cover _mocha -- -R spec"
|
||||
},
|
||||
"keywords": [
|
||||
"express",
|
||||
"regexp"
|
||||
],
|
||||
"component": {
|
||||
"scripts": {
|
||||
"path-to-regexp": "index.js"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pillarjs/path-to-regexp.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^1.17.1",
|
||||
"istanbul": "^0.2.6"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user