mwalajs 1.0.2 → 1.0.4
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/README.md +3 -0
- package/app.mjs +1 -0
- package/bin/mwala.mjs +2 -1
- package/createProject.mjs +3 -3
- package/{mwalajs/index.mjs → index.mjs} +32 -44
- package/package.json +44 -30
- package/mwalajs/package.json +0 -16
- /package/{mwalajs/index.js → index.js} +0 -0
package/README.md
CHANGED
|
@@ -539,4 +539,7 @@ Click below to download rar file mwalajs framework :
|
|
|
539
539
|
|
|
540
540
|
|
|
541
541
|
git clone https://github.com/mwala400/mwalajs.git
|
|
542
|
+

|
|
543
|
+

|
|
544
|
+

|
|
542
545
|
|
package/app.mjs
CHANGED
package/bin/mwala.mjs
CHANGED
|
@@ -53,8 +53,9 @@ if (!command || command === 'help' || command === 'h') {
|
|
|
53
53
|
switch (command) {
|
|
54
54
|
case 'version':
|
|
55
55
|
case '-v':
|
|
56
|
+
case 'v':
|
|
56
57
|
case '--version':
|
|
57
|
-
console.log('MwalaJS Version: 1.0.
|
|
58
|
+
console.log('MwalaJS Version: 1.0.4');
|
|
58
59
|
process.exit(0);
|
|
59
60
|
|
|
60
61
|
case 'create-project':
|
package/createProject.mjs
CHANGED
|
@@ -51,9 +51,9 @@ async function createProject() {
|
|
|
51
51
|
fs.mkdirSync(newProjectPath);
|
|
52
52
|
|
|
53
53
|
const itemsToCopy = [
|
|
54
|
-
"app.mjs", "controllers", "
|
|
55
|
-
"views", "middlewares", "models",
|
|
56
|
-
"README.md",
|
|
54
|
+
"app.mjs", "controllers", "migrations", "routes",
|
|
55
|
+
"views", "middlewares", "models",
|
|
56
|
+
"README.md","public"
|
|
57
57
|
];
|
|
58
58
|
|
|
59
59
|
for (const item of itemsToCopy) {
|
|
@@ -1,85 +1,68 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
|
|
3
3
|
class Mwala {
|
|
4
|
-
// ... constructor, set, use, etc.
|
|
5
4
|
constructor() {
|
|
6
5
|
this.app = express();
|
|
7
|
-
this.settings = {};
|
|
8
6
|
}
|
|
9
7
|
|
|
8
|
+
// Set application settings
|
|
10
9
|
set(setting, value) {
|
|
11
|
-
this.settings[setting] = value;
|
|
12
10
|
this.app.set(setting, value);
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} else {
|
|
19
|
-
this.app.use(route);
|
|
20
|
-
}
|
|
13
|
+
// Accept multiple middlewares or (path, middleware)
|
|
14
|
+
use(...args) {
|
|
15
|
+
this.app.use(...args);
|
|
21
16
|
}
|
|
22
17
|
|
|
23
|
-
static
|
|
24
|
-
|
|
18
|
+
// Serve static files
|
|
19
|
+
useStatic(dirPath) {
|
|
20
|
+
this.app.use(express.static(dirPath));
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
// Route methods
|
|
24
|
+
get(...args) {
|
|
25
|
+
this.app.get(...args);
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
post(...args) {
|
|
29
|
+
this.app.post(...args);
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
get(path, handler) {
|
|
38
|
-
this.app.get(path, handler);
|
|
32
|
+
put(...args) {
|
|
33
|
+
this.app.put(...args);
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
this.app.
|
|
36
|
+
delete(...args) {
|
|
37
|
+
this.app.delete(...args);
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
this.app.
|
|
40
|
+
listen(port, callback) {
|
|
41
|
+
this.app.listen(port, callback);
|
|
47
42
|
}
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
Router() {
|
|
45
|
+
return express.Router();
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
//
|
|
48
|
+
// Built-in body parsers
|
|
54
49
|
json() {
|
|
55
50
|
return express.json();
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
urlencoded(options) {
|
|
53
|
+
urlencoded(options = { extended: true }) {
|
|
59
54
|
return express.urlencoded(options);
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
return express.raw(options);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
text(options) {
|
|
67
|
-
return express.text(options);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async cookieParser(secret) {
|
|
71
|
-
const { default: cookieParser } = await import('cookie-parser');
|
|
72
|
-
return cookieParser(secret);
|
|
73
|
-
}
|
|
74
|
-
|
|
57
|
+
// Async external middlewares
|
|
75
58
|
async session(options) {
|
|
76
59
|
const { default: session } = await import('express-session');
|
|
77
60
|
return session(options);
|
|
78
61
|
}
|
|
79
62
|
|
|
80
|
-
async
|
|
81
|
-
const { default:
|
|
82
|
-
return
|
|
63
|
+
async cookieParser(secret) {
|
|
64
|
+
const { default: cookieParser } = await import('cookie-parser');
|
|
65
|
+
return cookieParser(secret);
|
|
83
66
|
}
|
|
84
67
|
|
|
85
68
|
async helmet(options) {
|
|
@@ -92,6 +75,11 @@ class Mwala {
|
|
|
92
75
|
return compression(options);
|
|
93
76
|
}
|
|
94
77
|
|
|
78
|
+
async morgan(format) {
|
|
79
|
+
const { default: morgan } = await import('morgan');
|
|
80
|
+
return morgan(format);
|
|
81
|
+
}
|
|
82
|
+
|
|
95
83
|
async override(method) {
|
|
96
84
|
const { default: methodOverride } = await import('method-override');
|
|
97
85
|
return methodOverride(method);
|
|
@@ -112,7 +100,7 @@ class Mwala {
|
|
|
112
100
|
return bodyParser.json();
|
|
113
101
|
}
|
|
114
102
|
|
|
115
|
-
async bodyParserUrlencoded(options) {
|
|
103
|
+
async bodyParserUrlencoded(options = { extended: true }) {
|
|
116
104
|
const { default: bodyParser } = await import('body-parser');
|
|
117
105
|
return bodyParser.urlencoded(options);
|
|
118
106
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mwalajs",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "MwalaJS Framework CLI Tool",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "MwalaJS Framework CLI Tool and Web Framework for Backend and Frontend Development.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "app.mjs",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"cli": "node bin/mwala.mjs"
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.mjs"
|
|
10
9
|
},
|
|
11
10
|
"bin": {
|
|
12
11
|
"mwala": "bin/mwala.mjs"
|
|
13
12
|
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "node app.mjs",
|
|
15
|
+
"cli": "node bin/mwala.mjs",
|
|
16
|
+
"test": "echo \"No test specified\" && exit 0",
|
|
17
|
+
"prepare": "npm run build",
|
|
18
|
+
"build": "echo 'Build step if needed'",
|
|
19
|
+
"postinstall": "echo 'Thanks for installing MwalaJS Framework! '"
|
|
20
|
+
},
|
|
14
21
|
"dependencies": {
|
|
15
22
|
"dotenv": "^16.4.7",
|
|
16
23
|
"ejs": "^3.1.10",
|
|
@@ -26,33 +33,40 @@
|
|
|
26
33
|
"sequelize": "^6.37.6",
|
|
27
34
|
"sqlite3": "^5.1.7"
|
|
28
35
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"node18-macos-x64"
|
|
50
|
-
],
|
|
51
|
-
"outputPath": "dist"
|
|
52
|
-
},
|
|
53
|
-
"author": "HEKIMA AMBALILE MWALA",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"mwalajs",
|
|
38
|
+
"mwala",
|
|
39
|
+
"framework",
|
|
40
|
+
"nodejs",
|
|
41
|
+
"express",
|
|
42
|
+
"mvc",
|
|
43
|
+
"cli",
|
|
44
|
+
"generator",
|
|
45
|
+
"backend",
|
|
46
|
+
"frontend",
|
|
47
|
+
"web-framework",
|
|
48
|
+
"orm",
|
|
49
|
+
"rest-api"
|
|
50
|
+
],
|
|
51
|
+
"author": {
|
|
52
|
+
"name": "Hekima Ambalile Mwala",
|
|
53
|
+
"email": "biasharaboraofficials@gmail.com",
|
|
54
|
+
"url": "https://github.com/mwala400"
|
|
55
|
+
},
|
|
54
56
|
"license": "MIT",
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/mwala400/mwalajs.git"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/mwala400/mwalajs/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/mwala400/mwalajs#readme",
|
|
55
65
|
"engines": {
|
|
56
66
|
"node": ">=18.0.0"
|
|
67
|
+
},
|
|
68
|
+
"sideEffects": false,
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
57
71
|
}
|
|
58
72
|
}
|
package/mwalajs/package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mwalajs",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"description": "",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"express": "^4.21.2"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
File without changes
|