-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: removed useNewUrlParser and useUnifiedTopology #348
feat: removed useNewUrlParser and useUnifiedTopology
- Loading branch information
Showing
4 changed files
with
38 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/src/config/db.config.js
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/src/config/dbConfig.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import mongoose from "mongoose"; | ||
import { dbName, dbUrl } from "./initialConfig.js"; | ||
import chalk from "chalk"; | ||
|
||
const connectDB = async () => { | ||
try { | ||
await mongoose.connect(dbUrl, { | ||
dbName, | ||
}); | ||
console.log(`${chalk.green.bold("Connected")} to the database`); | ||
} catch (error) { | ||
console.log(`${chalk.red.bold("Error")} connecting to database`, error); | ||
process.exit(1); | ||
} | ||
}; | ||
|
||
export default connectDB; |
File renamed without changes.