Skip to content

Commit

Permalink
fix: moving to https base
Browse files Browse the repository at this point in the history
  • Loading branch information
MatMath committed Mar 11, 2021
1 parent 9c16b64 commit 07738cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 39 deletions.
8 changes: 4 additions & 4 deletions bin/www
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env node
const https = require("https");
const http = require("http");
const fs = require("fs");

const options = {
key: fs.readFileSync("./bin/key.pem"),
cert: fs.readFileSync("./bin/cert.pem")
key: fs.readFileSync("./bin/server.key"),
cert: fs.readFileSync("./bin/server.cert")
};

const app = require('../src/app');
const port = process.env.API_PORT || 3001;

app.dBconnect().then(() => {
const server = https.createServer(options, app).listen(port, () => {
const server = http.createServer(app).listen(port, () => {
console.log(`Express server listening on port ${server.address().port}`);
});
});
48 changes: 15 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
"express-session": "^1.15.6",
"joi": "^11.4.0",
"joi-objectid": "^2.0.0",
"mongodb": "^3.1.4",
"mongodb": "^3.3.2",
"passport": "^0.4.0",
"passport-google-oauth2": "^0.1.6",
"passport-local": "^1.0.0"
},
"devDependencies": {
"dtrace-provider": "^0.8.8",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.14.0",
Expand Down
2 changes: 1 addition & 1 deletion src/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let dbName;
const dBconnect = async () => {
let client;
try {
client = await MongoClient.connect(mongourl, { useNewUrlParser: true });
client = await MongoClient.connect(mongourl, { useNewUrlParser: true, useUnifiedTopology: false });
dbName = client.db(mongoDBName);
return dbName;
} catch (error) {
Expand Down

0 comments on commit 07738cb

Please sign in to comment.