bragg-route-invoke

2.1.0 • Public • Published

bragg-route-invoke Build Status

Invoke bragg routes in a lambda function.

Install

$ npm install --save bragg-route-invoke

Usage

const invoke = require('bragg-route-invoke');
 
invoke.get('myFunction', '/foo/{bar}', {params: {bar: 'bar'}}).then(result => {
    // handle result
});
 
invoke.post('myFunction', '/foo', {body: {foo: 'bar'}}).then(() => {
    // resource created
});
 
invoke.postAsync('myFunction', '/foo', {body: {foo: 'bar'}}).then(() => {
    // don't wait for the target function to be executed
});

API

invoke.get(fn, path, [options])

invoke.put(fn, path, [options])

invoke.putAsync(fn, path, [options])

invoke.patch(fn, path, [options])

invoke.patchAsync(fn, path, [options])

invoke.post(fn, path, [options])

invoke.postAsync(fn, path, [options])

invoke.delete(fn, path, [options])

invoke.deleteAsync(fn, path, [options])

fn

Type: string

Lambda function name that should be invoked.

path

Type: string

Resource path of the function defined by the router.

options

body

Type: object

Body of the request.

params

Type: object

Params of the request.

query

Type: object

Query string of the request.

identity

Type: object

Identity of the request.

Related

License

MIT © Sam Verschueren

Package Sidebar

Install

npm i bragg-route-invoke

Weekly Downloads

4

Version

2.1.0

License

MIT

Unpacked Size

5.75 kB

Total Files

4

Last publish

Collaborators

  • samverschueren