Skip to content

Commit

Permalink
hide the secret in env file
Browse files Browse the repository at this point in the history
Relates #39
  • Loading branch information
ArielLB committed Oct 31, 2019
1 parent 8a66807 commit acc10ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/private.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function request(url, cb) {
if (err) {
throw new Error("We have an error:", err);
} else {
var transactions = JSON.parse(data)
var transactions = JSON.parse(data);
var table = document.getElementById("transactions-table");
transactions.forEach(function(tran) {
var row = document.createElement("tr");
Expand Down
4 changes: 2 additions & 2 deletions src/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const login_query=require("./queries/login_query")
const signup_query = require("./queries/sign_up_query");
const transactions_query = require("./queries/transactions_query");
const addTransaction_query= require("./queries/addTransaction_query");

require('env2')('config.env');
const { parse } = require('cookie');
const { sign, verify } = require('jsonwebtoken');
const { comparePasswords, hashPassword}=require('./scripts/passwordmangment');
var userid;
const SECRET = 'poiugyfguhijokpkoihugyfyguhijo';
const SECRET = process.env.SECRET;
const serverError = (err, response) => {
response.writeHead(500, "Content-Type:text/html");
response.end("<h1>Sorry, there was a problem loading the homepage</h1>");
Expand Down
2 changes: 2 additions & 0 deletions src/queries/transactions_query.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const databaseConnection = require("../database/db_connection.js");


//the db connection query is already a promise!!
const transactions = (email) => {
return new Promise((res)=>{
res(databaseConnection.query(`SELECT t.date,t.descrip,t.charge FROM users u JOIN transactions t ON u.email=t.email WHERE t.email=$1 ORDER BY t.trans_id desc`,
Expand Down

0 comments on commit acc10ec

Please sign in to comment.