1 | # Changelog
|
2 |
|
3 | ## v1.0.0
|
4 |
|
5 | ### `.use` supports array of middlewares
|
6 |
|
7 | You can now pass an array of middlewares to `.use` [#288](https://github.com/middyjs/middy/pull/288) by [@alexdebrie](https://github.com/alexdebrie)
|
8 |
|
9 | ```javascript
|
10 | const middy = require('@middy/core')
|
11 | const middleware1 = require('sample-middleware1')
|
12 | const middleware2 = require('sample-middleware2')
|
13 | const middleware3 = require('sample-middleware3')
|
14 | const middlewares = [middleware1(), middleware2(), middleware3()]
|
15 |
|
16 | const originalHandler = (event, context, callback) => {
|
17 | /* your business logic */
|
18 | }
|
19 |
|
20 | const handler = middy(originalHandler)
|
21 |
|
22 | handler.use(middlewares)
|
23 |
|
24 | module.exports = { handler }
|
25 | ```
|