diff options
| author | d1y <[email protected]> | 2020-08-22 00:11:20 +0800 |
|---|---|---|
| committer | d1y <[email protected]> | 2020-08-22 00:11:20 +0800 |
| commit | d94b2f64ab01fe16fbd45983d828abb3e687fe58 (patch) | |
| tree | 3ca04f509819efdd66381d04efa78a17c126d622 /db | |
| parent | Merge pull request #1 from fossabot/add-license-scan-badge (diff) | |
| download | counter-d94b2f64ab01fe16fbd45983d828abb3e687fe58.tar.xz counter-d94b2f64ab01fe16fbd45983d828abb3e687fe58.zip | |
add default mongodb url(local server)
Diffstat (limited to 'db')
| -rw-r--r-- | db/mongodb.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/db/mongodb.js b/db/mongodb.js index fa7e96d..40f7695 100644 --- a/db/mongodb.js +++ b/db/mongodb.js @@ -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 |