@onemedia/data-resolvers
v2.7.1
Published
Common methods of resolving data from different services. Includes reporting timing information.
Downloads
51
Readme
Data Resolvers
Common methods of resolving data from different services. Includes reporting timing information.
const { Memcached } = require('@onemedia/data-resolvers');
Table of Contents
Requirements
- [Node.js][node] 14+
- [npm][npm] (normally comes with Node.js)
Usage
@onemedia/data-resolvers
is installed via [npm][npm]:
npm install @onemedia/data-resolvers
Then you can load the relevant module into your code with a require
call:
const { Memcached, Dynamodb } = require('@onemedia/data-resolvers');
All modules are required to be instantiated with the parameters required for the use of the underlying service.
const { Dynamodb } = require('@onemedia/data-resolvers');
const database = new Dynamodb({
table: process.env.MY_TABLE_NAME,
config: { } // config passed to DynamoDB Client
});
const { Memcached } = require('@onemedia/data-resolvers');
const memcache = new Memcached(process.env.CACHE_URL, { retries: 1, failures: 1, timeout: 500 });