Skip to content

Commit

Permalink
Replace var with const
Browse files Browse the repository at this point in the history
  • Loading branch information
fenichelar committed Sep 20, 2024
1 parent af1b0b0 commit 92b6002
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions test-app/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
})
});
Expand Down
8 changes: 4 additions & 4 deletions test-app/server/mocks/api/token-auth.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
10 changes: 5 additions & 5 deletions test-app/server/mocks/api/token-refresh.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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,
Expand Down

0 comments on commit 92b6002

Please sign in to comment.