Skip to content

Commit

Permalink
feat: Multiple middlewares support
Browse files Browse the repository at this point in the history
  • Loading branch information
muratcorlu committed Aug 21, 2019
1 parent d571706 commit 6de3694
Show file tree
Hide file tree
Showing 4 changed files with 5,740 additions and 142 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ exports.handler = use((req, res) => {
});
```

You can also use multiple middlewares for a single handler:

```js
const { use } = require('lambda-expressless');

const checkUser = (req, res, next) => {
if (req.get('Authorization') === 'someToken') {
next()
} else {
req.status(403).end('Forbidden');
}
};

const getUser = (req, res) => {
res.json({
id: '12',
name: 'Murat'
});
};

exports.handler = use(checkUser, getUser);
```

## Supported Features and Limitations

This project aims to implement functionalities of ExpressJS middlewares as much as possible. `Request` and `Response` objects have properties and methods listed below.
Expand Down
Loading

0 comments on commit 6de3694

Please sign in to comment.