mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 15:09:59 -04:00
Add fastly rule for express uri patterns
convert path variables in express (i.e. dev-server) into rules that work for fastly (i.e. `.+?`). I tried to make it `\w+?`, but javascript seemed to either want no `\`'s or two `\`'s
This commit is contained in:
parent
cad75217f0
commit
1e57262771
1 changed files with 1 additions and 0 deletions
|
@ -54,6 +54,7 @@ var getViewPaths = function (routes) {
|
|||
*/
|
||||
var pathsToCondition = function (paths) {
|
||||
return 'req.url~"' + paths.reduce(function (conditionString, pattern) {
|
||||
pattern = pattern.replace(/(:[^/]+)\//gi, '.+?/');
|
||||
return conditionString + (conditionString ? '|' : '') + pattern;
|
||||
}, '') + '"';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue