Persistent connection
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -50,6 +50,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
||||||
},
|
},
|
||||||
|
"connect-mongo": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/connect-mongo/-/connect-mongo-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-0Mx88079Z20CG909wCFlR3UxhMYGg6Ibn1hkIje1hwsqOLWtL9HJV+XD0DAjUvQScK6WqY/FA8tSVQM9rR64Rw==",
|
||||||
|
"requires": {
|
||||||
|
"mongodb": "^3.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"content-disposition": {
|
"content-disposition": {
|
||||||
"version": "0.5.3",
|
"version": "0.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
|
"connect-mongo": "^3.2.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-session": "^1.17.0",
|
"express-session": "^1.17.0",
|
||||||
"mongoose": "^5.8.7",
|
"mongoose": "^5.8.7",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const loginApi = require(path.join(__dirname + "/api/login"));
|
|||||||
const bodyParser = require("body-parser");
|
const bodyParser = require("body-parser");
|
||||||
|
|
||||||
const mongoose = require("mongoose");
|
const mongoose = require("mongoose");
|
||||||
|
const MongoStore = require("connect-mongo")(session);
|
||||||
mongoose.promise = global.Promise;
|
mongoose.promise = global.Promise;
|
||||||
mongoose.connect("mongodb://localhost/vinlottis");
|
mongoose.connect("mongodb://localhost/vinlottis");
|
||||||
mongoose.set("debug", true);
|
mongoose.set("debug", true);
|
||||||
@@ -23,9 +24,12 @@ app.use(bodyParser.json());
|
|||||||
app.use(
|
app.use(
|
||||||
session({
|
session({
|
||||||
secret: "passport-tutorial",
|
secret: "passport-tutorial",
|
||||||
cookie: { maxAge: 60000 },
|
cookie: { maxAge: 86400 * 24 * 24 },
|
||||||
resave: false,
|
resave: false,
|
||||||
saveUninitialized: false
|
saveUninitialized: false,
|
||||||
|
store: new MongoStore({
|
||||||
|
mongooseConnection: mongoose.connection
|
||||||
|
})
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user