notherbase-fs 4.0.19 → 4.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/notherbase-fs.js +12 -13
  2. package/package.json +1 -1
package/notherbase-fs.js CHANGED
@@ -27,18 +27,28 @@ class NotherBaseFS {
27
27
  this.spiritWorld = new SpiritWorld(this.io);
28
28
  this.creation = new Creation(bases);
29
29
 
30
+ //set views path
31
+ this.app.set("view engine", "ejs");
32
+ this.app.set("views", `${__dirname}/views`);
33
+
34
+ // allows us to use post body data
35
+ this.app.use(express.json({
36
+ extended: true,
37
+ inflate: true,
38
+ type: 'application/x-www-form-urlencoded'
39
+ }));
40
+
30
41
  //be safe, needs to be before session
31
42
  if (process.env.PRODUCTION == "true") this.app.set('trust proxy', 1);
32
43
 
33
44
  this.app.use(cors());
34
45
 
35
46
  let baseKeys = Object.keys(this.bases);
36
- let mongoStore = MongoStore.create({ mongoUrl: process.env.MONGODB_URI });
37
47
  for (let i = 0; i < baseKeys.length; i++) {
38
48
  this.bases[baseKeys[i]].static = express.static(this.bases[baseKeys[i]].directory + "/public");
39
49
  this.bases[baseKeys[i]].favicon = favicon(this.bases[baseKeys[i]].directory + this.bases[baseKeys[i]].icon);
40
50
  this.bases[baseKeys[i]].session = session({
41
- store: mongoStore,
51
+ store: MongoStore.create({ mongoUrl: process.env.MONGODB_URI }),
42
52
  secret: process.env.SECRET,
43
53
  name: baseKeys[i] + '-session-id',
44
54
  resave: false,
@@ -51,17 +61,6 @@ class NotherBaseFS {
51
61
  }
52
62
  });
53
63
  }
54
-
55
- //set views path
56
- this.app.set("view engine", "ejs");
57
- this.app.set("views", `${__dirname}/views`);
58
-
59
- // allows us to use post body data
60
- this.app.use(express.json({
61
- extended: true,
62
- inflate: true,
63
- type: 'application/x-www-form-urlencoded'
64
- }));
65
64
 
66
65
  //provide database access and etc to use in routes
67
66
  this.app.use((req, res, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "4.0.19",
3
+ "version": "4.0.20",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "exports": "./notherbase-fs.js",
6
6
  "scripts": {