Skip to content

Commit

Permalink
New static method is used to simplify routing queues.
Browse files Browse the repository at this point in the history
  • Loading branch information
shenyunjie committed Nov 24, 2017
1 parent accdd57 commit 1e7b166
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CHANGLOG.md
Expand Up @@ -2,6 +2,20 @@

> Since the 5.1.11 version, we will provide change logs for each version of the update.
## 5.1.15 pending - beta

- `miox-router` 新增`static`方法,用来简化路由队列。

**static**方法演示:

```javascript
route.static({
'/a/:id': WebviewA,
'/b/:id': WebviewB,
...
})
```

## v5.1.14

- 修正`dictionary`中key变量全部字符串化的Bug.
Expand Down
10 changes: 10 additions & 0 deletions src/miox-router/src/index.js
Expand Up @@ -23,6 +23,16 @@ export default class Router {
return this.patch(...args);
}

/* istanbul ignore next */
'static'(options = {}) {
for (const uri in options) {
this.patch(
uri,
async ctx => await ctx.render(options[uri])
);
}
}

/**
* Create `router.verb()` methods, where *verb* is one of the HTTP verbs such
* as `router.get()` or `router.post()`.
Expand Down

0 comments on commit 1e7b166

Please sign in to comment.