Thanks to @klemensz!
This commit is contained in:
Родитель
7d449f039a
Коммит
8741af85d3
|
@ -2084,6 +2084,17 @@
|
|||
"safer-buffer": "~2.1.0"
|
||||
}
|
||||
},
|
||||
"asn1.js": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
|
||||
"integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
|
||||
"requires": {
|
||||
"bn.js": "^4.0.0",
|
||||
"inherits": "^2.0.1",
|
||||
"minimalistic-assert": "^1.0.0",
|
||||
"safer-buffer": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"assert-never": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/assert-never/-/assert-never-1.2.1.tgz",
|
||||
|
@ -2408,6 +2419,11 @@
|
|||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
||||
},
|
||||
"bn.js": {
|
||||
"version": "4.12.0",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
|
||||
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||
|
@ -3015,10 +3031,28 @@
|
|||
"integrity": "sha1-2GMPJtlaf4UfmVax6MxnMvO2qjA="
|
||||
},
|
||||
"connect-mongo": {
|
||||
"version": "github:jdesboeufs/connect-mongo#527f9b6cd3d95d9bcd765c9ef9f2b5705611f9f5",
|
||||
"from": "github:jdesboeufs/connect-mongo#527f9b6cd3d95d9bcd765c9ef9f2b5705611f9f5",
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/connect-mongo/-/connect-mongo-4.4.0.tgz",
|
||||
"integrity": "sha512-TTv9SUeLazm7eAvrzDfcIbiRcgeK8Dhif6XLDxnL41S3/1+EtFUgdI+kx6lcZtEdobMY/ehLWtJ6+WTXtsQDvg==",
|
||||
"requires": {
|
||||
"mongodb": "^3.1.0"
|
||||
"debug": "^4.3.1",
|
||||
"kruptein": "^3.0.0",
|
||||
"mongodb": "3.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
||||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"constantinople": {
|
||||
|
@ -6452,6 +6486,14 @@
|
|||
"integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
|
||||
"dev": true
|
||||
},
|
||||
"kruptein": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/kruptein/-/kruptein-3.0.0.tgz",
|
||||
"integrity": "sha512-Fh5sIb+3XI9L12GsgeBQqXVRPLB1HVViKSUkqPPOcqTEX4NwoF8Z3pEfMSl3Psd1j+QlloV8Uxxwp4gk3aFBGA==",
|
||||
"requires": {
|
||||
"asn1.js": "^5.4.1"
|
||||
}
|
||||
},
|
||||
"kuler": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
|
||||
|
@ -6672,6 +6714,11 @@
|
|||
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
|
||||
"dev": true
|
||||
},
|
||||
"minimalistic-assert": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
|
||||
"integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
|
@ -6709,9 +6756,9 @@
|
|||
}
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz",
|
||||
"integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==",
|
||||
"version": "3.6.3",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz",
|
||||
"integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==",
|
||||
"requires": {
|
||||
"bl": "^2.2.1",
|
||||
"bson": "^1.1.4",
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"bluebird": "3.7.2",
|
||||
"body-parser": "1.19.0",
|
||||
"compression": "1.7.4",
|
||||
"connect-mongo": "jdesboeufs/connect-mongo#527f9b6cd3d95d9bcd765c9ef9f2b5705611f9f5",
|
||||
"connect-mongo": "4.4.0",
|
||||
"dotenv": "8.2.0",
|
||||
"errorhandler": "1.5.1",
|
||||
"express": "4.17.1",
|
||||
|
|
10
src/app.ts
10
src/app.ts
|
@ -3,7 +3,7 @@ import compression from "compression"; // compresses requests
|
|||
import session from "express-session";
|
||||
import bodyParser from "body-parser";
|
||||
import lusca from "lusca";
|
||||
import mongo from "connect-mongo";
|
||||
import MongoStore from "connect-mongo";
|
||||
import flash from "express-flash";
|
||||
import path from "path";
|
||||
import mongoose from "mongoose";
|
||||
|
@ -11,8 +11,6 @@ import passport from "passport";
|
|||
import bluebird from "bluebird";
|
||||
import { MONGODB_URI, SESSION_SECRET } from "./util/secrets";
|
||||
|
||||
const MongoStore = mongo(session);
|
||||
|
||||
// Controllers (route handlers)
|
||||
import * as homeController from "./controllers/home";
|
||||
import * as userController from "./controllers/user";
|
||||
|
@ -48,8 +46,10 @@ app.use(session({
|
|||
saveUninitialized: true,
|
||||
secret: SESSION_SECRET,
|
||||
store: new MongoStore({
|
||||
url: mongoUrl,
|
||||
autoReconnect: true
|
||||
mongoUrl,
|
||||
mongoOptions: {
|
||||
autoReconnect: true
|
||||
}
|
||||
})
|
||||
}));
|
||||
app.use(passport.initialize());
|
||||
|
|
Загрузка…
Ссылка в новой задаче