formation 4 anni fa
parent
commit
3eea0013de
2 ha cambiato i file con 22 aggiunte e 0 eliminazioni
  1. 17 0
      express-server/lib/db.js
  2. 5 0
      express-server/lib/role.js

+ 17 - 0
express-server/lib/db.js

@@ -0,0 +1,17 @@
+const mongoose = require('mongoose');
+const  config  = require('../config/config.json');
+
+//const db = config.url;
+
+var db = 'mongodb://163.172.88.141:27017/mean-fatboar-db';
+//var mongoURI = 'mongodb://localhost:27017/my-db';
+// mongoose.set('useCreateIndex', true)
+mongoose.connect(db, {useNewUrlParser: true, useUnifiedTopology: true })
+.then(() => {
+    console.log("Successfully connected to the database.");
+}).catch(err => {
+    console.log("Could not connect to the database.", err);
+});
+
+
+module.exports = mongoose.connection;

+ 5 - 0
express-server/lib/role.js

@@ -0,0 +1,5 @@
+module.exports = {
+    Admin: 'admin',
+    Employee: 'employee',
+    Client: 'client'
+}