We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
Here's a good reference example https://github.com/startupjs/startupjs/blob/e9ff2af2a4ff64e3628976845dd444e287fccd3e/packages/backend/index.js
Sorry, something went wrong.
Here's a complete starter.
import redis from 'redis'; import redisPubSub from 'sharedb-redis-pubsub'; import ShareDB from 'sharedb'; import ShareDBMingoMemory from 'sharedb-mingo-memory'; import ShareDBMongo from 'sharedb-mongo'; // Singletons. let shareDB; let connection; // Environment variables. const mongoURI = process.env.MONGO_URI; const redisHost = process.env.REDIS_HOST; export const getShareDB = () => { if (!shareDB) { const options = { db: mongoURI ? new ShareDBMongo(mongoURI) : new ShareDBMingoMemory(), }; if (process.env.VIZHUB_REDIS_HOST) { options.pubsub = redisPubSub({ client: redis.createClient({ host: redisHost }), }); } shareDB = ShareDB(options); } return shareDB; }; export const getConnection = () => { if (!connection) { connection = getShareDB().connect(); } return connection; };
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: