Skip to content

Commit

Permalink
add default mongodb url(local server)
Browse files Browse the repository at this point in the history
  • Loading branch information
d1y committed Aug 21, 2020
1 parent a5130cc commit d94b2f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion db/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
const mongoose = require('mongoose')
const schema = require('./schema')

mongoose.connect(process.env.DB_URL, {
// the default mongodb url (local server)
let mongodbURL = `mongodb://127.0.0.1:27017`
const envMongoURL = process.env.DB_URL
if (envMongoURL) mongodbURL = envMongoURL

mongoose.connect(mongodbURL, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false
Expand Down

0 comments on commit d94b2f6

Please sign in to comment.