Use dotenv
This commit is contained in:
parent
20a9dae85a
commit
7767371a3c
1 changed files with 4 additions and 2 deletions
|
|
@ -1,10 +1,12 @@
|
||||||
import { json as BodyParserJson, urlencoded as BodyParserUrlEncoded } from 'body-parser'
|
import { json as BodyParserJson, urlencoded as BodyParserUrlEncoded } from 'body-parser'
|
||||||
|
import { config as InitEnv } from 'dotenv'
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import mongoose from 'mongoose'
|
import mongoose from 'mongoose'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import routes from './app/routes'
|
import routes from './app/routes'
|
||||||
|
|
||||||
|
InitEnv()
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
app.use(BodyParserJson())
|
app.use(BodyParserJson())
|
||||||
|
|
@ -19,7 +21,7 @@ app.set('views', path.join(__dirname, './app/Views'))
|
||||||
|
|
||||||
/* Begin connection to MongoDB via Mongoose */
|
/* Begin connection to MongoDB via Mongoose */
|
||||||
|
|
||||||
mongoose.connect('mongodb://172.16.1.10/URLShortener', {
|
mongoose.connect(`mongodb://${process.env.MONGO_URL}/URLShortener`, {
|
||||||
useNewUrlParser: true,
|
useNewUrlParser: true,
|
||||||
useUnifiedTopology: true
|
useUnifiedTopology: true
|
||||||
}).then((db) => {
|
}).then((db) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue