notherbase-fs 1.2.11 → 1.2.12
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.
- package/controllers/index.js +1 -1
- package/controllers/pages.js +19 -0
- package/index.js +4 -2
- package/package.json +2 -2
- package/server.js +3 -3
- package/test/pages/test.ejs +12 -0
- package/test/test-index.js +2 -1
- package/controllers/portfolio/portfolio-controller.js +0 -10
- package/test.js +0 -1
package/controllers/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const express = require("express");
|
|
2
|
+
const router = express.Router();
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
module.exports = function name(path)
|
|
6
|
+
{
|
|
7
|
+
let files = fs.readdirSync(path);
|
|
8
|
+
|
|
9
|
+
files.forEach(file => {
|
|
10
|
+
file = file.slice(0, -4);
|
|
11
|
+
console.log(file);
|
|
12
|
+
|
|
13
|
+
router.get(`/${file}`, function(req, res) {
|
|
14
|
+
res.render(`${path}/${file}.ejs`);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return router;
|
|
19
|
+
}
|
package/index.js
CHANGED
|
@@ -8,13 +8,15 @@ module.exports = {
|
|
|
8
8
|
},
|
|
9
9
|
data: db,
|
|
10
10
|
chat: null,
|
|
11
|
-
start: function start(world) {
|
|
11
|
+
start: function start(world, pagesPath) {
|
|
12
12
|
let theFront = require("./controllers/the-front");
|
|
13
13
|
let explorer = require("./controllers/explorer");
|
|
14
14
|
|
|
15
15
|
explorer.complete(world.explorer);
|
|
16
16
|
theFront.complete(world.theFront);
|
|
17
17
|
|
|
18
|
-
require("./
|
|
18
|
+
let pagesRouter = require("./controllers/pages")(pagesPath);
|
|
19
|
+
|
|
20
|
+
require("./server")(theFront.router, explorer.router, pagesRouter, db.connectionSuccess);
|
|
19
21
|
}
|
|
20
22
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notherbase-fs",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"description": "Functions to help make developing for NotherBase easier.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "nodemon test.js",
|
|
7
|
+
"test": "nodemon test/test-index.js",
|
|
8
8
|
"gmail-auth": "node gmail-auth.js",
|
|
9
9
|
"gmail-token": "node gmail-token.js"
|
|
10
10
|
},
|
package/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let started = false;
|
|
2
2
|
|
|
3
|
-
module.exports = function start(frontRouter, exploreRouter, dbConnected) {
|
|
3
|
+
module.exports = function start(frontRouter, exploreRouter, pagesRouter, dbConnected) {
|
|
4
4
|
if (!started) {
|
|
5
5
|
// Setup for Express
|
|
6
6
|
const express = require("express");
|
|
@@ -57,8 +57,6 @@ module.exports = function start(frontRouter, exploreRouter, dbConnected) {
|
|
|
57
57
|
|
|
58
58
|
app.use("/user", controllers.user);
|
|
59
59
|
|
|
60
|
-
app.use("/portfolio", controllers.portfolio);
|
|
61
|
-
|
|
62
60
|
app.use("/chat", controllers.chat(io));
|
|
63
61
|
|
|
64
62
|
app.use("/contact", controllers.contact);
|
|
@@ -70,6 +68,8 @@ module.exports = function start(frontRouter, exploreRouter, dbConnected) {
|
|
|
70
68
|
app.use("/item", controllers.item);
|
|
71
69
|
|
|
72
70
|
app.use("/the-front", frontRouter);
|
|
71
|
+
|
|
72
|
+
app.use("/", pagesRouter);
|
|
73
73
|
|
|
74
74
|
app.use("/", controllers.authCheck, exploreRouter);
|
|
75
75
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Document</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
Test hahahahahah
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
package/test/test-index.js
CHANGED
package/test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require("./test/test-index");
|