UNPKG

@gospime/racer-backend

Version:

Create backend for Racer or Derby.js and add extensions

36 lines (33 loc) 1.29 kB
const shareDbMongo = require('sharedb-mongo'); const PubSub = require('sharedb-redis-pubsub'); const Redis = require('redis-url'); module.exports = settings => { const { uriMongo, uriRedis, uriRedisPubSub } = settings || {}; return { db: shareDbMongo(uriMongo, { useUnifiedTopology: true // safe: true /** * Allow $while and $mapReduce queries. These queries let you run arbitrary JS on the server. * If users make these queries from the browser, there's security issues. */ //, allowJSQueries: false // Aggregate queries are less dangerous, but you can use them to access any data in the mongo database. //, allowAggregateQueries: false }), pubsub: PubSub({ client: Redis.connect(uriRedis), observer: Redis.connect(uriRedisPubSub) }), // DEPRECATED: "doc" middleware action. Use "readSnapshots" instead. // Pass `disableDocAction: true` option to ShareDB to disable the "doc" action and this warning. disableDocAction: true, // DEPRECATED: "after submit" middleware action. Use "afterSubmit" instead. // Pass `disableSpaceDelimitedActions: true` option to ShareDB to disable the "after submit" action and this warning. disableSpaceDelimitedActions: true }; };