From 57a64b780905637e2f013ad4c439eaa50e6e3da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 25 Feb 2022 09:59:33 -0500 Subject: [PATCH] refactor: add server side helpers.js --- src/helpers.js | 7 +++++++ src/webserver.js | 2 +- test/template-helpers.js | 3 +-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/helpers.js diff --git a/src/helpers.js b/src/helpers.js new file mode 100644 index 0000000000..b75e950c26 --- /dev/null +++ b/src/helpers.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = require('../public/src/modules/helpers.common')( + require('./utils'), + require('benchpressjs'), + require('nconf').get('relative_path'), +); diff --git a/src/webserver.js b/src/webserver.js index 6326ded225..df7b9c3456 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -34,7 +34,7 @@ const topicEvents = require('./topics/events'); const routes = require('./routes'); const auth = require('./routes/authentication'); -const helpers = require('../public/src/modules/helpers.common')(require('./utils'), Benchpress, nconf.get('relative_path')); +const helpers = require('./helpers'); if (nconf.get('ssl')) { server = require('https').createServer({ diff --git a/test/template-helpers.js b/test/template-helpers.js index f69f2b9354..b89b726fd2 100644 --- a/test/template-helpers.js +++ b/test/template-helpers.js @@ -2,10 +2,9 @@ const nconf = require('nconf'); const assert = require('assert'); -const benchpress = require('benchpressjs'); const db = require('./mocks/databasemock'); -const helpers = require('../public/src/modules/helpers.common')(require('../src/utils'), benchpress, nconf.get('relative_path')); +const helpers = require('../src/helpers'); describe('helpers', () => { it('should return false if item doesn\'t exist', (done) => {