add default mongodb url(local server)
This commit is contained in:
parent
a5130cc5a3
commit
d94b2f64ab
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue