Skip to content

Commit 90100b8

Browse files
committed
fix env
1 parent 5e69b9b commit 90100b8

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

dbconnection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
require('dotenv').config();
12
const mongoose = require("mongoose");
2-
const conString = "mongodb://test:[email protected]:45923/huizingdb";
33

44
function Connect(){
5-
mongoose.connect(conString, {useNewUrlParser: true}, (err) => {
5+
mongoose.connect(process.env.DB, {useNewUrlParser: true}, (err) => {
66
if(err){
77
throw(err);
88
}

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
}
2727

2828
function getChats() {
29-
$.get("/chats", (chats) => {
30-
chats.forEach(addChat)
31-
})
29+
$.get("/chats", (chats) => {
30+
chats.forEach(addChat)
31+
})
3232
}
3333
function addChat(chatObj){
3434
$("#messages").append(`<h5>${chatObj.name} </h5><p>${chatObj.chat}</p>`);

models.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ const ChatSchema = new mongoose.Schema({
1313

1414
var Chats = mongoose.model("Chats", ChatSchema);
1515

16-
exports.ChatsModel = Chats;
17-
exports.Message = Message;
18-
exports.ChatSchema = ChatSchema;
16+
exports.ChatsModel = Chats;

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"license": "ISC",
1111
"dependencies": {
1212
"body-parser": "^1.18.3",
13+
"dotenv": "^6.2.0",
1314
"express": "^4.16.4",
1415
"mongoose": "^5.3.7",
1516
"socket.io": "^2.1.1"

0 commit comments

Comments
 (0)