Revert "migrate heroku env"

This reverts commit 069000dc9a.
This commit is contained in:
Priyatham-sai-chand 2021-03-24 23:32:18 +05:30 committed by Priyatham Sai Chand
parent b07ec34ee6
commit 3a31fda96a
3 changed files with 2 additions and 21 deletions

View File

@ -1,15 +0,0 @@
import dotenv from 'dotenv';
import _ from 'lodash';
const result = dotenv.config();
let envs;
if (!('error' in result)) {
envs = result.parsed;
} else {
envs = {};
_.each(process.env, (value, key) => envs[key] = value);
}
module.exports = envs;

View File

@ -5,7 +5,6 @@ const auth = require("../middleware/auth");
const User = require("../schemas/User");
const config = require("config");
import { jwtSecret } from '../config/config';
router.post("/register", async (req, res) => {
try {
@ -61,8 +60,7 @@ router.post("/login", async (req, res) => {
const isMatch = await bcrypt.compare(password, user.password);
if (!isMatch) return res.status(400).json({ msg: "Invalid credentials." });
//const token = jwt.sign({ id: user._id },config.get('jwtSecret'));
const token = jwt.sign({ id: user._id }, jwtSecret);
const token = jwt.sign({ id: user._id },config.get('jwtSecret'));
if(token) return res
.json({
token,

View File

@ -2,7 +2,6 @@ const express = require("express");
const config = require("config");
const mongoose = require("mongoose");
const cors = require("cors");
import { mongoURI } from './config/config';
// set up express
@ -17,8 +16,7 @@ app.listen(PORT, () => console.log(`The server has started on port: ${PORT}`));
// set up mongoose
mongoose.connect(
//config.get('mongoURI'),
mongoURI,
config.get('mongoURI'),
{
useNewUrlParser: true,
useUnifiedTopology: true,