Skip to content

Commit

Permalink
update database connection to heroku app
Browse files Browse the repository at this point in the history
  • Loading branch information
rajnidua committed Oct 15, 2021
1 parent 3efdd7c commit eef73dd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ app.use(express.json());

app.use(express.static("public"));

mongoose.connect("mongodb://localhost/budget", {
useNewUrlParser: true,
useFindAndModify: false
});
mongoose.connect(
process.env.MONGODB_URI || "mongodb://localhost/budgetTrackerSchema",
{
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
}
);

// routes
app.use(require("./routes/api.js"));

app.listen(PORT, () => {
console.log(`App running on port ${PORT}!`);
});
});

0 comments on commit eef73dd

Please sign in to comment.