@jtviegas/store-functions

1.0.0 • Public • Published

Build Status Coverage Status

store-functions

functions for a data store api

Installation

npm install @jtviegas/store-functions

Usage

required environment variables or configuration properties

  • STOREFUNCTIONS_AWS_REGION
  • STOREFUNCTIONS_AWS_DB_ENDPOINT - optional, used for local testing;
  • STOREFUNCTIONS_AWS_ACCESS_KEY_ID
  • STOREFUNCTIONS_AWS_ACCESS_KEY
  • STOREFUNCTIONS_ENTITY_LIST
  • STOREFUNCTIONS_TENANT
  • STOREFUNCTIONS_ENV_LIST

code snippet example

let config = {
    STOREFUNCTIONS_AWS_REGION: 'eu-west-1'
    , STOREFUNCTIONS_AWS_ACCESS_KEY_ID: process.env.ACCESS_KEY_ID
    , STOREFUNCTIONS_AWS_ACCESS_KEY: process.env.ACCESS_KEY
    , STOREFUNCTIONS_ENTITY_LIST: 'item, part'
    , STOREFUNCTIONS_TENANT: 'xpto'
    , STOREFUNCTIONS_ENV_LIST: 'production,development'
};

const functions = require('@jtviegas/store-functions')(config);
let event = {
                httpMethod: 'GET'
                , pathParameters: {
                    entity: 'item'
                }
                , queryStringParameters: {
                    env: 'development'
                }
            };
functions.handler(event, context, (e,d)=>{
    if(e)
        done(e);
    else {
        let r=JSON.parse(d.body);
        expect(r.length).to.equal(A_NUMBER);
        done(null);
    }
});

Check the test folder in source tree.

Tests

npm test

Contributing

just help yourself and submit a pull request

Dependents (0)

Package Sidebar

Install

npm i @jtviegas/store-functions

Weekly Downloads

0

Version

1.0.0

License

Unlicense

Unpacked Size

14.4 kB

Total Files

8

Last publish

Collaborators

  • jtviegas