From b5b49c542473304713bf611ddec86f56861427ab Mon Sep 17 00:00:00 2001 From: JayWll Date: Sat, 11 Apr 2020 13:00:00 -0600 Subject: [PATCH] Adding dotenv to app.js to enable running in dev environment --- nodeapp/app.js | 3 +++ nodeapp/utils/import.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index a22ed49..007c5be 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -1,5 +1,7 @@ // Initialize project const db = require('./db/db') +const path = require('path') +require('dotenv').config({path: path.join(__dirname, '../.env')}) const express = require('express'); const app = express(); @@ -79,5 +81,6 @@ app.get('/cleanup', (req, res) => { // listen for requests :) const listener = app.listen(process.env.PORT || 4200, function() { + console.log(process.env.DB_USER) console.log("Your app is listening on port " + listener.address().port); }); diff --git a/nodeapp/utils/import.js b/nodeapp/utils/import.js index b711b11..f7831e0 100644 --- a/nodeapp/utils/import.js +++ b/nodeapp/utils/import.js @@ -1,7 +1,7 @@ const db = require('../db/db') const request = require('request') const path = require('path') -const dotenv = require('dotenv').config({path: path.join(__dirname, '../../.env')}) +require('dotenv').config({path: path.join(__dirname, '../../.env')}) // The URL from which to export production data const url = 'https://jasonsplant.glitch.me/exportall'