Policies made easy by aex middlewares with fallback

When your middlewares are failed.
fallbacks can be added to rescue.

It is quite useful for policies.

1. define your middleware, return `false` when failed.

```
const logined = async function(this:User, req, res, scope) => {
this.name = “Peter”;
if (…) {
return false
}
};
```
2. define your fallback processer,

```
const notLoginHandler = async function fallback(this:User, req, res, scope){
// some fallback processing
res.end(“Fallback”);
}
```

3. inject it to your web request processing

```ts
class User {
private name = “Aex”;
@http(“post”, “/user/login”)
@body()
@inject(login, notLoginHandler)
public async login(req: any, res: any, scope: any) {
// req.session.user.name
// ok

}
}
```

see more details [here](https://github.com/calidion/aex#inject)

--

--