npm.io
2.1.0 • Published 5 years ago

bragg-route-invoke

Licence
MIT
Version
2.1.0
Deps
1
Size
6 kB
Vulns
0
Weekly
0
Stars
1

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.

License

MIT Sam Verschueren

Keywords