@lambdev/client

1.0.0 • Public • Published

@lambdev/client

TODO: description

Usage

const Client = require('@lambdev/client');

const client = new Client();

(async () => {

  // launch container running the LambDev API
  client.start();

  // create a function
  await client.createFunction({
    runtime: 'nodejs10.x',
    name: 'foobar',
    // lambda function code is located in ./task/index.js
    handler: 'index.handler',
    code: { S3Bucket: process.cwd(), S3Key: 'task' },
  });

  // Invoke a function
  const [res, body] = await client.invoke('foobar', { foo: 'bar' });
  console.log(res.statusCode, body);

  // Alternatively, use the aws-sdk to work with the API
  const AWS = require('aws-sdk');

  const endpoint = await client.getEndpoint();
  const lambda = new AWS.Lambda({
    endpoint,
    accessKeyId: 'ACCESS_KEY',
    secretAccessKey: 'SECRET_KEY',
  });
  lambda.createFunction(...).promise();
  lambda.invoke(...).promise();
  lambda.updateFunctionCode(...).promise();

})();

Readme

Keywords

none

Package Sidebar

Install

npm i @lambdev/client

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0

Unpacked Size

17.6 kB

Total Files

4

Last publish

Collaborators

  • monken