Skip to content

Commit

Permalink
update path-to-regexp to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxin committed Nov 3, 2017
1 parent f763180 commit 406f687
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ app.use(rewrite('/:src..:dst', '/commits/:src/to/:dst'));
for example `/js/vendor/jquery.js` would become `/public/assets/js/vendor/jquery.js`:

```js
app.use(rewrite('/js/*', '/public/assets/js/$1'));
app.use(rewrite('/js/(.*)', '/public/assets/js/$1'));
```

## Debugging
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"license": "MIT",
"dependencies": {
"debug": "*",
"path-to-regexp": "0.0.2"
"path-to-regexp": "^2.1.0"
},
"engines": {
"node": ">= 4"
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ describe('new Koa-rewrite', () => {
.expect('/commits/foo/to/bar', done);
});

it('rewrite /js/* -> /public/assets/js/$1', done => {
it('rewrite /js/(.*) -> /public/assets/js/$1', done => {
const app = new Koa();
app.use(differentPathHelper);
app.use(rewrite('/js/*', '/public/assets/js/$1'));
app.use(rewrite('/js/(.*)', '/public/assets/js/$1'));
app.use((ctx) => {
ctx.body = ctx.path;
});
Expand Down

0 comments on commit 406f687

Please sign in to comment.