Add mongodb to dotenv
This commit is contained in:
parent
21e059fd33
commit
e0813ba69c
2 changed files with 4 additions and 2 deletions
|
@ -1,2 +1,3 @@
|
||||||
URL="http://localhost"
|
URL="http://localhost"
|
||||||
SERVER_PORT="3030"
|
SERVER_PORT="3030"
|
||||||
|
MONGO="mongodb://127.0.0.1:27017/urlshortener"
|
|
@ -1,8 +1,9 @@
|
||||||
|
require('dotenv').config()
|
||||||
// import mongoose package
|
// import mongoose package
|
||||||
const mongoose = require('mongoose')
|
const mongoose = require('mongoose')
|
||||||
|
|
||||||
// declare a Database string URI
|
// declare a Database string URI
|
||||||
const DB_URI = 'mongodb://127.0.0.1:27017/urlshortener'
|
const DB_URI = process.env.MONGO
|
||||||
|
|
||||||
// establishing a database connection
|
// establishing a database connection
|
||||||
mongoose.connect(DB_URI)
|
mongoose.connect(DB_URI)
|
||||||
|
|
Loading…
Reference in a new issue