@dployhub/feathers-dynamoose

0.3.2-alpha.7 • Public • Published

feathers-dynamoose

Build Status Code Climate Test Coverage Download Status

Feathers service with AWS DynamoDb via dynamoose

Installation

npm install @dployhub/feathers-dynamoose --save

Documentation

// app.js
const feathersDynamoose = require('@dployhub/feathers-dynamoose');

app.use('/users', feathersDynamoose(
  options, // See below for full list of options
  optionalDynamooseOptions // See https://dynamoosejs.com/api#dynamoosemodelname-schema-options
));

Options

Options is a JavaScript object with the following keys:

Key Description Required
modelName The name of the model.
schema The schema for the model. Refer to https://dynamoosejs.com/api/schema/#options
localUrl If the key is present, will instantiate dynamoose with dynamoose.local(localUrl)

Examples

// src/users/schema.js
module.exports = {
  postId: {type: String, hashKey: true},
  blogId: {type: String, rangeKey: true},
};

// src/app.js
const uuid = require('uuid/v4');
const feathersDynamoose = require('@dployhub/feathers-dynamoose');
const postsSchema = require('users/schema');

app.use('/v1/posts', feathersDynamoose({modelName: 'posts', schema: postsSchema}));
// create a new record
const record = await app.service('v1/posts').create({postId: uuid(), blogId: uuid()});
// delete a record. id accepts an object.
await app.service('v1/posts').delete({postId: record.postId, blogId: record.blogId});

License

Copyright (c) 2018

Licensed under the MIT license.

Package Sidebar

Install

npm i @dployhub/feathers-dynamoose

Weekly Downloads

3

Version

0.3.2-alpha.7

License

MIT

Unpacked Size

48.5 kB

Total Files

5

Last publish

Collaborators

  • andrewchak