Skip to content

Commit c743e6e

Browse files
committed
Clean up cluters in index.js to resemble a lean application diver
1 parent 18da86c commit c743e6e

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

index.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import request from 'request';
33
import express from 'express';
44
import bodyParser from 'body-parser';
55
import {encryptAES, decryptAES} from './crypto.js';
6-
import { data as currencyCodes } from 'currency-codes';
7-
import awssdk from 'aws-sdk';
6+
87

98
// application secrets
109
import { keys } from './config/keys.js';
@@ -15,26 +14,9 @@ import { router as currencyExchangeRoutes } from './routes/currency-exchange-rou
1514
// routes handler for WeatherBit.io API methods
1615
import { router as weatherbitRoutes } from './routes/weatherbit-routes.js';
1716

18-
let WEATHERBIT_KEY = "";
19-
let WEATHERBIT_URI = "";
20-
17+
// dev env
2118
dotenv.config();
2219

23-
if (process.env.NODE_ENV === 'awsdeploy') {
24-
WEATHERBIT_URI="https://api.weatherbit.io/v2.0/";
25-
WEATHERBIT_KEY="U2FsdGVkX18HMV5UUT9rJN76hOtIHDw1bH0beQYWH8a6E7uzKqskdgHvc6Nq2lO6O+GAb2vrcL+X8ZDqcGPuLw==";
26-
console.log("AWSDEPLOY mode!");
27-
} else {
28-
// Code for Development Mode
29-
// WEATHERBIT_KEY = process.env.WEATHERBIT_KEY;
30-
// WEATHERBIT_URI = process.env.WEATHERBIT_URI;
31-
32-
WEATHERBIT_KEY = keys.weatherbitapi.APIKEY;
33-
WEATHERBIT_URI = keys.weatherbitapi.URI;
34-
}
35-
36-
37-
3820
// Create network routing
3921
const app = express();
4022

@@ -55,8 +37,7 @@ app.use('/weatherbit', weatherbitRoutes);
5537

5638
// Homepage: get the locale from the client-side via the ejs form
5739
app.get('/', (req, res) => {
58-
let apikey = encryptAES(WEATHERBIT_KEY);
59-
res.render('index', {xkey: apikey});
40+
res.render('index', {xkey: 'hey'});
6041
})
6142

6243
// about page

0 commit comments

Comments
 (0)