mwalajs 1.0.1
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/.env +5 -0
- package/LICENSE +21 -0
- package/README.md +542 -0
- package/app.mjs +23 -0
- package/bin/backupnewclean.js +162 -0
- package/bin/mwala.mjs +176 -0
- package/config/createTablesetdb.mjs +38 -0
- package/config/createdatabase.mjs +157 -0
- package/config/serverConfig.mjs +1 -0
- package/controllers/fileController.mjs +15 -0
- package/controllers/homeController.mjs +28 -0
- package/createProject.mjs +120 -0
- package/migrations/20250308115724_create_users.mjs +45 -0
- package/migrations/20250724111240_create_transactions.mjs +19 -0
- package/migrations/migration_log.json +1 -0
- package/models/exampleModel.mjs +5 -0
- package/mwala +5 -0
- package/mwala.cmd +2 -0
- package/mwalajs/index.js +109 -0
- package/mwalajs/index.mjs +121 -0
- package/mwalajs/package-lock.json +836 -0
- package/mwalajs/package.json +16 -0
- package/package.json +58 -0
- package/public/styles.css +115 -0
- package/routes/homeRoutes.mjs +12 -0
- package/runMigrations.mjs +137 -0
- package/setupMwalajs.mjs +58 -0
- package/ujasi/README.md +542 -0
- package/ujasi/app.mjs +33 -0
- package/ujasi/bin/backupnewclean.js +162 -0
- package/ujasi/bin/mwala.mjs +176 -0
- package/ujasi/config/createTablesetdb.mjs +38 -0
- package/ujasi/config/createdatabase.mjs +156 -0
- package/ujasi/config/serverConfig.mjs +1 -0
- package/ujasi/controllers/fileController.mjs +15 -0
- package/ujasi/controllers/homeController.mjs +28 -0
- package/ujasi/models/exampleModel.mjs +5 -0
- package/ujasi/mwalajs/index.js +109 -0
- package/ujasi/mwalajs/index.mjs +121 -0
- package/ujasi/mwalajs/package-lock.json +836 -0
- package/ujasi/mwalajs/package.json +16 -0
- package/ujasi/package-lock.json +8546 -0
- package/ujasi/package.json +58 -0
- package/ujasi/public/styles.css +115 -0
- package/ujasi/routes/homeRoutes.mjs +12 -0
- package/ujasi/runMigrations.mjs +137 -0
- package/ujasi/setupMwalajs.mjs +58 -0
- package/ujasi/views/about.ejs +159 -0
- package/ujasi/views/index.ejs +227 -0
- package/ujasi/views/sitemap.xml +1 -0
- package/ujasi/views/steps.ejs +514 -0
- package/ujasi/views/welcome.ejs +257 -0
- package/views/about.ejs +159 -0
- package/views/index.ejs +227 -0
- package/views/sitemap.xml +1 -0
- package/views/steps.ejs +514 -0
- package/views/welcome.ejs +257 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
|
|
3
|
+
class Mwala {
|
|
4
|
+
// ... constructor, set, use, etc.
|
|
5
|
+
constructor() {
|
|
6
|
+
this.app = express();
|
|
7
|
+
this.settings = {};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
set(setting, value) {
|
|
11
|
+
this.settings[setting] = value;
|
|
12
|
+
this.app.set(setting, value);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
use(route, handler) {
|
|
16
|
+
if (typeof route === 'string') {
|
|
17
|
+
this.app.use(route, handler);
|
|
18
|
+
} else {
|
|
19
|
+
this.app.use(route);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static(pathDir) {
|
|
24
|
+
this.app.use(express.static(pathDir));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
listen(port, callback) {
|
|
28
|
+
this.app.listen(port, callback);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Router() {
|
|
32
|
+
return express.Router();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
// ADD THESE METHODS to support GET/POST/PUT/DELETE
|
|
37
|
+
get(path, handler) {
|
|
38
|
+
this.app.get(path, handler);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
post(path, handler) {
|
|
42
|
+
this.app.post(path, handler);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
put(path, handler) {
|
|
46
|
+
this.app.put(path, handler);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
delete(path, handler) {
|
|
50
|
+
this.app.delete(path, handler);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ✅ Proxy core express middleware
|
|
54
|
+
json() {
|
|
55
|
+
return express.json();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
urlencoded(options) {
|
|
59
|
+
return express.urlencoded(options);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
raw(options) {
|
|
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
|
+
|
|
75
|
+
async session(options) {
|
|
76
|
+
const { default: session } = await import('express-session');
|
|
77
|
+
return session(options);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async morgan(format) {
|
|
81
|
+
const { default: morgan } = await import('morgan');
|
|
82
|
+
return morgan(format);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async helmet(options) {
|
|
86
|
+
const { default: helmet } = await import('helmet');
|
|
87
|
+
return helmet(options);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async compress(options) {
|
|
91
|
+
const { default: compression } = await import('compression');
|
|
92
|
+
return compression(options);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async override(method) {
|
|
96
|
+
const { default: methodOverride } = await import('method-override');
|
|
97
|
+
return methodOverride(method);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async cors(options) {
|
|
101
|
+
const { default: cors } = await import('cors');
|
|
102
|
+
return cors(options);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async rateLimit(options) {
|
|
106
|
+
const { default: rateLimit } = await import('express-rate-limit');
|
|
107
|
+
return rateLimit(options);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async bodyParserJson() {
|
|
111
|
+
const { default: bodyParser } = await import('body-parser');
|
|
112
|
+
return bodyParser.json();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async bodyParserUrlencoded(options) {
|
|
116
|
+
const { default: bodyParser } = await import('body-parser');
|
|
117
|
+
return bodyParser.urlencoded(options);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default new Mwala();
|