From f0435be0b27d25333fbc74939f204b3bd94a444f Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 7 Sep 2017 15:31:32 -0700 Subject: [PATCH] moved constants back to individual modules --- controllers/serveController.js | 5 ++++- helpers/constants.js | 8 -------- routes/serve-routes.js | 9 +++++++-- 3 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 helpers/constants.js diff --git a/controllers/serveController.js b/controllers/serveController.js index f5c5c571..3bdec26f 100644 --- a/controllers/serveController.js +++ b/controllers/serveController.js @@ -3,7 +3,10 @@ const db = require('../models'); const logger = require('winston'); const { resolveAgainstClaimTable, serveFile, showFile, showFileLite, getShortClaimIdFromLongClaimId, getClaimIdByLongChannelId, getAllChannelClaims, getLongChannelId, getShortChannelIdFromLongChannelId, getLongClaimId } = require('../helpers/serveHelpers.js'); const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js'); -const { SERVE, SHOW, SHOWLITE } = require('../helpers/constants.js'); + +const SERVE = 'SERVE'; +const SHOW = 'SHOW'; +const SHOWLITE = 'SHOWLITE'; function checkForLocalAssetByClaimId (claimId, name) { return new Promise((resolve, reject) => { diff --git a/helpers/constants.js b/helpers/constants.js deleted file mode 100644 index 28c7b7f1..00000000 --- a/helpers/constants.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - SERVE : 'SERVE', - SHOW : 'SHOW', - SHOWLITE : 'SHOWLITE', - CHANNEL : 'CHANNEL', - CLAIM : 'CLAIM', - CHANNELID_INDICATOR: ':', -}; diff --git a/routes/serve-routes.js b/routes/serve-routes.js index 12c2184a..b7574e4b 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -1,7 +1,13 @@ const logger = require('winston'); const { getAssetByClaim, getChannelContents, getAssetByChannel, serveOrShowAsset } = require('../controllers/serveController.js'); const { handleRequestError } = require('../helpers/errorHandlers.js'); -const { SERVE, SHOW, SHOWLITE, CHANNEL, CLAIM, CHANNELID_INDICATOR } = require('../helpers/constants.js'); + +const SERVE = 'SERVE'; +const SHOW = 'SHOW'; +const SHOWLITE = 'SHOWLITE'; +const CHANNEL = 'CHANNEL'; +const CLAIM = 'CLAIM'; +const CHANNELID_INDICATOR = ':'; function isValidClaimId (claimId) { return ((claimId.length === 40) && !/[^A-Za-z0-9]/g.test(claimId)); @@ -84,7 +90,6 @@ module.exports = (app) => { getAsset(claimType, channelName, channelId, name, claimId) // 2. serve or show .then(fileInfo => { - logger.debug('fileInfo', fileInfo); if (!fileInfo) { res.status(200).render('noClaims'); } else {