mdkcontroller 1.0.6 → 1.0.9
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/demoApp.js +1 -0
- package/main.js +7 -6
- package/package.json +1 -1
package/demoApp.js
CHANGED
package/main.js
CHANGED
|
@@ -5,18 +5,19 @@ import pkg_body_parser from 'body-parser';
|
|
|
5
5
|
const {json} = pkg_body_parser;
|
|
6
6
|
import {join} from "path";
|
|
7
7
|
import cookieParser from "cookie-parser";
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import {fileURLToPath} from 'url';
|
|
10
8
|
|
|
11
9
|
import dbInstant from "./dk_modules/dkdb.js";
|
|
12
10
|
import userInstant from "./dk_modules/users.js";
|
|
13
11
|
import authInstant from "./dk_modules/authorization.js";
|
|
12
|
+
import {fileURLToPath} from "url";
|
|
13
|
+
import path from 'path';
|
|
14
14
|
// import {privateKey, encodeMini} from "./dk_modules/dkvar.js";
|
|
15
15
|
|
|
16
16
|
export default async function (appname) {
|
|
17
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
-
const __dirname = path.dirname(__filename);
|
|
19
17
|
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __rootDirPath = path.dirname(__filename).toLowerCase();
|
|
20
|
+
const __parentAppPath = __rootDirPath.replace('\\node_modules\\mdkcontroller'.toLowerCase(), '');
|
|
20
21
|
const app = express();
|
|
21
22
|
const server = createServer(app);
|
|
22
23
|
const db = await dbInstant(appname + "-Database.json");
|
|
@@ -52,8 +53,8 @@ export default async function (appname) {
|
|
|
52
53
|
next();
|
|
53
54
|
});
|
|
54
55
|
|
|
55
|
-
app.use("/Pages", staticExpress(join(
|
|
56
|
-
app.use("/Cores", staticExpress(join(
|
|
56
|
+
app.use("/Pages", staticExpress(join(__parentAppPath, "Pages")));
|
|
57
|
+
app.use("/Cores", staticExpress(join(__rootDirPath, "Cores")));
|
|
57
58
|
app.use("/api", userRoutes.router);
|
|
58
59
|
return {
|
|
59
60
|
server: app,
|