From 92b600288b87749c190319ef921b002cfa1370d9 Mon Sep 17 00:00:00 2001 From: Alec Fenichel Date: Fri, 20 Sep 2024 17:45:01 -0400 Subject: [PATCH] Replace var with const --- test-app/server/index.js | 6 +++--- test-app/server/mocks/api/token-auth.js | 8 ++++---- test-app/server/mocks/api/token-refresh.js | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test-app/server/index.js b/test-app/server/index.js index d971c3d..12c02f9 100644 --- a/test-app/server/index.js +++ b/test-app/server/index.js @@ -5,10 +5,10 @@ module.exports = function() { const express = require('express'); const app = express(); const { globSync } = require('glob'); - var mocks = globSync('server/mocks/api/*.js', {cwd: process.cwd()}); + const mocks = globSync('server/mocks/api/*.js', {cwd: process.cwd()}); // Log proxy requests - var morgan = require('morgan'); + const morgan = require('morgan'); app.use(morgan('dev')); app.get('/api/helloworld', function(req, res) { @@ -25,7 +25,7 @@ module.exports = function() { mocks.map(function(cwd, len, fileNames) { fileNames.forEach(function(fileName) { - var route = require('.' + fileName.replace('server', '')); + const route = require('.' + fileName.replace('server', '')); route(app); }) }); diff --git a/test-app/server/mocks/api/token-auth.js b/test-app/server/mocks/api/token-auth.js index ea41039..e7bdf38 100644 --- a/test-app/server/mocks/api/token-auth.js +++ b/test-app/server/mocks/api/token-auth.js @@ -1,8 +1,8 @@ module.exports = function(app) { - var express = require('express'); - var bodyParser = require('body-parser'); - var jwt = require('jsonwebtoken'); - var apiTokenAuthRouter = express.Router(); + const express = require('express'); + const bodyParser = require('body-parser'); + const jwt = require('jsonwebtoken'); + const apiTokenAuthRouter = express.Router(); apiTokenAuthRouter.post('/', function(req, res) { res.set('Access-Control-Allow-Origin', 'http://localhost:4201'); diff --git a/test-app/server/mocks/api/token-refresh.js b/test-app/server/mocks/api/token-refresh.js index 9e749d8..7eede88 100644 --- a/test-app/server/mocks/api/token-refresh.js +++ b/test-app/server/mocks/api/token-refresh.js @@ -1,8 +1,8 @@ module.exports = function(app) { - var express = require('express'); - var bodyParser = require('body-parser'); - var jwt = require('jsonwebtoken'); - var apiTokenRefreshRouter = express.Router(); + const express = require('express'); + const bodyParser = require('body-parser'); + const jwt = require('jsonwebtoken'); + const apiTokenRefreshRouter = express.Router(); apiTokenRefreshRouter.post('/', function(req, res) { res.set('Access-Control-Allow-Origin', 'http://localhost:4201'); @@ -16,7 +16,7 @@ module.exports = function(app) { } else { delete decoded.iat; delete decoded.exp; - var token = jwt.sign(decoded, 'secret', { expiresIn: '5m' }); + const token = jwt.sign(decoded, 'secret', { expiresIn: '5m' }); return res.send({ token: token, refresh_token: token,