Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump bson from 1.0.4 to 1.0.9 #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove dependency on databases
Ben1152000 committed Jul 22, 2021
commit 7ac9d7f2c97236d64ef5f6adf67903c89e1652f4
22 changes: 13 additions & 9 deletions bin/server.js
Original file line number Diff line number Diff line change
@@ -6,12 +6,16 @@ const app = require("../src/app");
const port = ( process.env.PORT || 5000 );
const http = require("http");

models.sequelize.sync({
logging: app.get("env") !== "production" && console.log,
force: false
}).then(() => {
console.log("Successfully migrated and connected to database");
http.createServer(app).listen(port, () => console.log("Server listening in on port", port));
}).catch((err) => {
console.log("Could not connect to database", err);
});
// models.sequelize.sync({
// logging: app.get("env") !== "production" && console.log,
// force: false
// }).then(() => {
// console.log("Successfully migrated and connected to database");
// http.createServer(app).listen(port, () => console.log("Server listening in on port", port));
// }).catch((err) => {
// console.log("Could not connect to database", err);
// });

// Ben: I removed the lines above so that the site will work without the database.

http.createServer(app).listen(port, () => console.log("Server listening in on port", port));
201 changes: 201 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@
"node": "8.2.1"
},
"devDependencies": {
"gh-pages": "^3.2.3",
"install-peers": "^1.0.3",
"node-sass": "^4.13.0",
"nodemon": "^1.18.3"
36 changes: 19 additions & 17 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -23,29 +23,31 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(logger("dev"));

let SessionStore = process.env.NODE_ENV == "production" ? (
new MongoStore({
url: process.env.SESSION_STORE,
ttl: 14 * 24 * 60 * 60
})
) : undefined;

app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
store: SessionStore,
cookie: {
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 60)
}
}));
app.use(flash());
// let SessionStore = process.env.NODE_ENV == "production" ? (
// new MongoStore({
// url: process.env.SESSION_STORE,
// ttl: 14 * 24 * 60 * 60
// })
// ) : undefined;

// app.use(session({
// secret: process.env.SESSION_SECRET,
// resave: false,
// saveUninitialized: false,
// store: SessionStore,
// cookie: {
// expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 60)
// }
// }));
// app.use(flash());

// Passport initialize
require("./config/passport");
app.use(passport.initialize());
app.use(passport.session());

// Ben: I removed the lines above so that the site will work without the database.

// Import main route controller here
require("./routes/controller")(app);