paginate\r
};\r
\r
- const mongoConfig = app.get('mongo');\r
- const rateLimitConfig = app.get('rate-limit');\r
-\r
- const createUserLimiter = new RateLimit({\r
- store: new MongoStore({\r
- uri: 'mongodb://' + mongoConfig.username + ':' + mongoConfig.password + '@' + mongoConfig.baseUrl +\r
- mongoConfig.dbOtf + '?replicaSet=' + mongoConfig.replicaSet,\r
- collectionName: rateLimitConfig.mongoStore.collection\r
- }),\r
- max: app.get('rate-limit').services.users.max,\r
- windowsMs: app.get('rate-limit').services.users.windowMs,\r
- message: app.get('rate-limit').services.users.message\r
- });\r
-\r
// Initialize our service with any options it requires,\r
// and limit any POST methods.\r
- app.use(app.get('base-path') + 'users', (req, res, next) => {\r
- if (req.method === 'POST') {\r
- createUserLimiter(req, res, next);\r
- } else {\r
- next();\r
- }\r
- }, createService(options));\r
+ app.use(app.get('base-path') + 'users', createService(options));\r
\r
// Get our initialized service so that we can register hooks\r
const service = app.service(app.get('base-path') + 'users');\r