Skip to content

Commit

Permalink
fix: wrong env var name
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdev03 committed Apr 27, 2024
1 parent 3a83bff commit a1267ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions apps/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The Backend is a simple Node.js application that uses the pm2 BUS API to communi
## Configuration

```bash
MONGO_URI=<MongoDB URI>
DB_URI=<MongoDB URI>
SERVER_NAME=used instead of the host name (optional)
```

## Installation
Expand All @@ -26,7 +27,7 @@ MONGO_URI=<MongoDB URI>
2. Create a `.env` file in the `apps/backend` directory and add the following variables

```bash
MONGO_URI=<MongoDB URI>
DB_URI=<MongoDB URI>
```

## Setup
Expand Down
8 changes: 4 additions & 4 deletions apps/backend/handlers/connectDb.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import mongoose from "mongoose";

const connectDb = (MONGO_URI: string | undefined) => {
if (!MONGO_URI) {
throw new Error("MONGO_URI is not defined");
const connectDb = (DB_URI: string | undefined) => {
if (!DB_URI) {
throw new Error("DB_URI is not defined");
}
mongoose
.connect(MONGO_URI)
.connect(DB_URI)
.then(() => {
console.log("[DATABASE] Connected");
})
Expand Down

0 comments on commit a1267ab

Please sign in to comment.