@drifted/db 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const path = require('path');
2
- require('@drifted/env');
3
- var initialize = require(path.join(__dirname, 'initialize'));
2
+ var initialize = require(path.join(__dirname, 'mongo', 'initialize'));
4
3
 
5
4
  initialize(process.env.MONGO_URL).
6
5
  catch(console.eror);
package/mongo/index.js ADDED
@@ -0,0 +1,6 @@
1
+ const path = require('path');
2
+ require('@drifted/env');
3
+ var initialize = require(path.join(__dirname, 'initialize'));
4
+
5
+ initialize(process.env.MONGO_URL).
6
+ catch(console.eror);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drifted/db",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "db module that allows me to establish conventions between projects",
5
5
  "homepage": "https://github.com/driftless-group/db#readme",
6
6
  "bugs": {
package/redis/index.js ADDED
@@ -0,0 +1,12 @@
1
+ const path = require('path');
2
+ require('@drifted/env');
3
+ var initialize = require(path.join(__dirname, 'initialize'));
4
+
5
+ var client = initialize({url: process.env.REDIS_URL});
6
+
7
+ async function connect() {
8
+ await client.connect();
9
+ }
10
+ connect();
11
+
12
+ module.exports = client
@@ -0,0 +1,14 @@
1
+ var { createClient } = require('redis');
2
+
3
+ function initialize(options={}) {
4
+ if (options.url == undefined) {
5
+ options.url = 'redis://localhost:6379';
6
+ }
7
+
8
+ const client = createClient(options);
9
+ client.on('error', (err) => console.error('Redis Client Error', err));
10
+
11
+ return client;
12
+ }
13
+
14
+ module.exports = initialize;
File without changes