Refactored schemas, naming, and instantiation files.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import MongoStore from "connect-mongo";
|
||||
import session from "express-session";
|
||||
import { dbName, mongoURI } from "../database/mongoose.js";
|
||||
import { mongooseDbName, mongoURI } from "../database/mongoose.js";
|
||||
const sessionConf = {
|
||||
secret: process.env.SESSION_SECRET || "super duper secret string.",
|
||||
cookie: {
|
||||
@@ -12,7 +12,7 @@ const sessionConf = {
|
||||
};
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
sessionConf.cookie.secure = true;
|
||||
sessionConf.store = MongoStore.create({ mongoUrl: mongoURI, dbName: dbName });
|
||||
sessionConf.store = MongoStore.create({ mongoUrl: mongoURI, dbName: mongooseDbName });
|
||||
}
|
||||
export const userSession = session(sessionConf);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mongoose } from "../database/mongoose.js";
|
||||
import mongoose from "mongoose";
|
||||
|
||||
export function needDatabase(res, req, next) {
|
||||
if (mongoose.connection.readyState != 1) {
|
Reference in New Issue
Block a user