AWS SDK effect driver.
$ npm install redux-effects-aws
Makes it easy to write testable server side code that interacts with AWS services without mocking or running development services.
import awsMiddleware, {aws} from 'redux-effects-aws'
import flow, {flo} from 'redux-flo'
import bind from '@f/bind-middleware'
const io = bind([
flow()
awsMiddleware()
])
// run update
io(flo(testableUpdate))
// Action creator that updates an s3 object.
function * testableUpdate () {
// get object
let data = yield aws('S3', 'getObject', {
Bucket: 'test-bucket.weo.io',
Key: 'test.json'
})
let obj = JSON.parse(data.BODY.toString())
// update
obj.foo = 'qux'
// put object
yield aws('S3', 'putObject', {
Bucket: 'test-bucket.we.io',
Key: 'test.json',
Body: JSON.stringify(obj)
})
}
Effect driver.
config
- global aws config (e.g. region, output...)
Returns: redux effects middleware
Action creator.
service
- The service to use. Optionally can be an object with the signature, {service, options}, if you need to specify service options.method
- Method to call on service.params
- Params to use for call.
MIT