Adding dotenv to app.js to enable running in dev environment

This commit is contained in:
JayWll 2020-04-11 13:00:00 -06:00
parent b64126a7fe
commit b5b49c5424
2 changed files with 4 additions and 1 deletions

View File

@ -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);
});

View File

@ -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'