Minor Fixes: Added {useNewUrlParser} fix deprecated warning, suppress some console.log output
This commit is contained in:
parent
f809f8ecea
commit
63e1363dd2
29
server.js
29
server.js
@ -93,7 +93,7 @@ const mongoose = require('mongoose');
|
|||||||
mongoose.Promise = global.Promise;
|
mongoose.Promise = global.Promise;
|
||||||
|
|
||||||
// Connecting to the database
|
// Connecting to the database
|
||||||
mongoose.connect(dbConfig.url)
|
mongoose.connect(dbConfig.url, {useNewUrlParser: true})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("Successfully connected to MongoDB.");
|
console.log("Successfully connected to MongoDB.");
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
@ -230,20 +230,23 @@ http.createServer (app) .listen (http_port, function () {
|
|||||||
var options;
|
var options;
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
// In case it's a real certificate: add CA chain cersts (TODO: use array if required)
|
// In case it's a real certificate: add CA chain cersts (TODO: use array if required)
|
||||||
var ca = fs.readFileSync ('keys/ca_cert.pem');
|
var ca = fs.readFileSync ('keys/ca_cert.pem');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ca = undefined;
|
ca = undefined;
|
||||||
console.log ("Note: Can't read CA bundle: "+e);
|
console.log ("Note: Can't read CA bundle: "+e);
|
||||||
}
|
}
|
||||||
options = {
|
if (ca != null) {
|
||||||
key: fs.readFileSync ('keys/omkey.pem'),
|
|
||||||
cert: fs.readFileSync ('keys/certificate.pem'),
|
options = {
|
||||||
ca: ca
|
key: fs.readFileSync ('keys/omkey.pem'),
|
||||||
};
|
cert: fs.readFileSync ('keys/certificate.pem'),
|
||||||
https.createServer (options, app) .listen (https_port, function () {
|
ca: ca
|
||||||
console.log ("Express https server listening on port " + https_port);
|
};
|
||||||
});
|
https.createServer (options, app) .listen (https_port, function () {
|
||||||
|
console.log ("Express https server listening on port " + https_port);
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log ("Note: Can't read SSL keys/certs: "+e+"\nDisabling https server");
|
console.log ("Note: Can't read SSL keys/certs: "+e+"\nDisabling https server");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user