mwalajs 1.0.7 → 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/.env.backup-2025-12-04T08-55-09-593Z +5 -0
- package/app.mjs +4 -0
- package/bin/mwala copy.mjs +212 -0
- package/bin/mwala.mjs +244 -76
- package/config/createdatabase copy.mjs +362 -0
- package/config/createdatabase.mjs +0 -158
- package/package.json +1 -1
- package/public/images/hekima-mwala.jpg +0 -0
- package/public/images/hekima-mwala2.jpg +0 -0
- package/public/images/mwala3.jpg +0 -0
- package/public/images/mwalajs.jpg +0 -0
- package/public/images/mwalajs1.jpg +0 -0
- package/utils/dbUtils.mjs +150 -0
- package/views/about.ejs +271 -136
- package/views/index.ejs +325 -428
- package/views/mwalajs-framework-documentation.ejs +778 -0
- package/views/partials/footer.ejs +102 -0
- package/views/partials/header.ejs +160 -0
- package/views/steps copy.ejs +243 -0
- package/views/steps.ejs +208 -482
- package/views/welcome.ejs +242 -184
package/views/steps.ejs
CHANGED
|
@@ -1,514 +1,240 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<html lang="en">
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>MwalaJS Documentation</title>
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
font-family: Arial, sans-serif;
|
|
11
|
-
line-height: 1.6;
|
|
12
|
-
margin: 20px;
|
|
13
|
-
padding: 20px;
|
|
14
|
-
}
|
|
15
|
-
h1, h2, h3 {
|
|
16
|
-
color: #333;
|
|
17
|
-
}
|
|
18
|
-
pre {
|
|
19
|
-
background: #f4f4f4;
|
|
20
|
-
padding: 10px;
|
|
21
|
-
border-left: 4px solid #333;
|
|
22
|
-
}
|
|
23
|
-
.section {
|
|
24
|
-
margin-bottom: 40px;
|
|
25
|
-
}
|
|
26
|
-
</style>
|
|
27
|
-
</head>
|
|
28
|
-
<body>
|
|
29
|
-
|
|
30
|
-
<!-- Navbar -->
|
|
31
|
-
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
|
32
|
-
<div class="container-fluid">
|
|
33
|
-
<a class="navbar-brand" href="/">MwalaJS</a>
|
|
34
|
-
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
35
|
-
<span class="navbar-toggler-icon"></span>
|
|
36
|
-
</button>
|
|
37
|
-
<div class="collapse navbar-collapse" id="navbarNav">
|
|
38
|
-
<ul class="navbar-nav">
|
|
39
|
-
<li class="nav-item">
|
|
40
|
-
<a class="nav-link active" href="#overview">Overview</a>
|
|
41
|
-
</li>
|
|
42
|
-
<li class="nav-item">
|
|
43
|
-
<a class="nav-link" href="#installation">Installation</a>
|
|
44
|
-
</li>
|
|
45
|
-
<li class="nav-item">
|
|
46
|
-
<a class="nav-link" href="#commands">Commands</a>
|
|
47
|
-
</li>
|
|
48
|
-
<li class="nav-item">
|
|
49
|
-
<a class="nav-link" href="#structure">Project Structure</a>
|
|
50
|
-
</li>
|
|
51
|
-
<li class="nav-item">
|
|
52
|
-
<a class="nav-link" href="#example">Example Application</a>
|
|
53
|
-
</li>
|
|
54
|
-
<li class="nav-item">
|
|
55
|
-
<a class="nav-link" href="#conclusion">Conclusion</a>
|
|
56
|
-
</li>
|
|
57
|
-
</ul>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</nav>
|
|
61
|
-
|
|
62
|
-
<h1>MwalaJS - Complete Documentation</h1>
|
|
63
|
-
<p>Welcome to MwalaJS! This guide will help you install, configure, and use MwalaJS efficiently.</p>
|
|
64
|
-
|
|
65
|
-
<div class="section">
|
|
66
|
-
<h2>1. Installation</h2>
|
|
67
|
-
<p>You can install MwalaJS in multiple ways:</p>
|
|
68
|
-
<h3>Using GitHub Repository</h3>
|
|
69
|
-
<p>Clone the repository from GitHub:</p>
|
|
70
|
-
<pre>git clone https://github.com/mwala400/mwalajs.git</pre>
|
|
71
|
-
|
|
72
|
-
<br> <a class="btn" href="https://github.com/mwala400/mwalajs" target="_blank" download> from github https://github.com/mwala400/mwalajs v1.0.0</a>
|
|
73
|
-
|
|
74
|
-
<h3>Using a ZIP, EXE, or RAR File</h3>
|
|
75
|
-
<p>Download and extract the files from the available compressed format:</p>
|
|
76
|
-
<ul>
|
|
77
|
-
<li>ZIP: Extract using <code>WinRAR</code> or <code>7-Zip</code>.</li>
|
|
78
|
-
<li>RAR: Extract using <code>WinRAR</code>.</li>
|
|
79
|
-
<li>EXE: Run the installer and follow the instructions.</li>
|
|
80
|
-
</ul>
|
|
81
|
-
<br> <h2 class="section-title">1. VERSION RELEASE</h2>
|
|
82
|
-
<p>Click below to download the installer For Mwalajs framework:</p>
|
|
83
|
-
<br><a class="btn" href="https://mwalajs.biasharabora.com/files/mwalaJS_installer.exe" target="_blank" download>Download MwalaJS COMMAND SHELL (CLS) download .exe file here </a>
|
|
84
|
-
<br> <p>Click below to download zip file mwalajs framework:</p>
|
|
85
|
-
<br> <a class="btn" href="https://mwalajs.biasharabora.com/files/mwalajsm.zip" target="_blank" download>Download MwalaJS mwalajs.zip v1.0.0</a>
|
|
86
|
-
<br> <p>Click below to download rar file mwalajs framework :</p>
|
|
87
|
-
<br> <a class="btn" href="https://mwalajs.biasharabora.com/files/mwalajsm.rar" target="_blank" download>Download MwalaJS mwalajs.rar v1.0.0</a>
|
|
88
|
-
|
|
89
|
-
<br>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<div class="section">
|
|
93
|
-
<h2>2. Setting Up MwalaJS</h2>
|
|
94
|
-
<h3>Initialize MwalaJS</h3>
|
|
95
|
-
<pre>mwala init</pre>
|
|
96
|
-
<h3>Creating a New Project</h3>
|
|
97
|
-
<pre>mwala create-project</pre>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<div class="section">
|
|
101
|
-
<h2>3. Running the Application</h2>
|
|
102
|
-
<pre>mwala serve</pre>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="section">
|
|
106
|
-
<h2>4. Database Operations</h2>
|
|
107
|
-
<h3>Creating a Database</h3>
|
|
108
|
-
<pre>mwala create-db</pre>
|
|
109
|
-
<h3>Creating a Table</h3>
|
|
110
|
-
<pre>mwala create-table <table_name></pre>
|
|
111
|
-
<h3>Dropping a Table</h3>
|
|
112
|
-
<pre>mwala drop-table <table_name></pre>
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
<div class="section">
|
|
116
|
-
<h2>5. Code Generation</h2>
|
|
117
|
-
<pre>
|
|
118
|
-
mwala generate model <name>
|
|
119
|
-
mwala generate controller <name>
|
|
120
|
-
mwala generate route <name>
|
|
121
|
-
mwala generate view <name>
|
|
122
|
-
mwala generate midware <name>
|
|
123
|
-
</pre>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
<div class="section">
|
|
127
|
-
<h2>6. Additional Information</h2>
|
|
128
|
-
<p>For more details, visit: <a href="https://github.com/mwala400/mwalajs" target="_blank">GitHub Repository</a></p>
|
|
129
|
-
</div>
|
|
130
|
-
</body>
|
|
131
|
-
</html>
|
|
1
|
+
<!-- include partials/header -->
|
|
2
|
+
<%- include('partials/header') %>
|
|
132
3
|
|
|
133
4
|
<!DOCTYPE html>
|
|
134
5
|
<html lang="en">
|
|
135
6
|
<head>
|
|
136
7
|
<meta charset="UTF-8">
|
|
137
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
138
|
-
<meta name="description" content="MwalaJS Framework Documentation -
|
|
139
|
-
<meta name="keywords" content="MwalaJS, Node.js, MVC framework,
|
|
9
|
+
<meta name="description" content="MwalaJS Framework Documentation - Lightweight Node.js MVC framework with CLI tools, code generation, database migrations, and EJS templating.">
|
|
10
|
+
<meta name="keywords" content="MwalaJS, Node.js, MVC framework, Express.js wrapper, CLI, code generation, database migrations, EJS views">
|
|
140
11
|
<meta name="author" content="Hekima Ambalile Mwala">
|
|
141
|
-
<meta property="og:title" content="MwalaJS Framework Documentation">
|
|
142
|
-
<meta property="og:description" content="
|
|
12
|
+
<meta property="og:title" content="MwalaJS Framework - Full Documentation">
|
|
13
|
+
<meta property="og:description" content="Complete guide to MwalaJS: installation, commands, project structure, code examples, and more.">
|
|
143
14
|
<meta property="og:url" content="https://mwalajs.biasharabora.com">
|
|
144
15
|
<meta property="og:image" content="https://mwalajs.biasharabora.com/images/mwala-logo.png">
|
|
145
16
|
<title>MwalaJS Framework Documentation</title>
|
|
146
|
-
|
|
17
|
+
|
|
18
|
+
<!-- Bootstrap 5 for responsive, modern design -->
|
|
19
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
20
|
+
<!-- Font Awesome for icons -->
|
|
21
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
22
|
+
|
|
147
23
|
<style>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
font-size: 1.5rem;
|
|
154
|
-
}
|
|
155
|
-
.code-block {
|
|
156
|
-
background-color: #f8f9fa;
|
|
157
|
-
padding: 10px;
|
|
158
|
-
border-radius: 5px;
|
|
159
|
-
border: 1px solid #ddd;
|
|
160
|
-
font-family: 'Courier New', Courier, monospace;
|
|
24
|
+
:root {
|
|
25
|
+
--primary: #0d6efd;
|
|
26
|
+
--dark: #212529;
|
|
27
|
+
--light: #f8f9fa;
|
|
28
|
+
--gradient: linear-gradient(135deg, #0d6efd, #6610f2);
|
|
161
29
|
}
|
|
30
|
+
body { font-family: 'Segoe UI', sans-serif; background: var(--light); line-height: 1.6; }
|
|
31
|
+
h1, h2, h3 { color: var(--primary); }
|
|
32
|
+
.navbar { background: var(--gradient) !important; }
|
|
33
|
+
.nav-link { color: white !important; }
|
|
34
|
+
.nav-link:hover { color: #ffc107 !important; }
|
|
35
|
+
pre, code { background: #1e1e1e; color: #f8f8f8; border-radius: 8px; }
|
|
36
|
+
.section-card { background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 6px 15px rgba(0,0,0,0.08); margin-bottom: 2rem; }
|
|
37
|
+
footer { background: var(--gradient); color: white; padding: 2rem 0; text-align: center; }
|
|
38
|
+
.btn-primary { background: var(--gradient); border: none; }
|
|
39
|
+
.structure-tree { font-family: monospace; background: #f1f1f1; padding: 1.5rem; border-radius: 8px; }
|
|
40
|
+
@media (max-width: 768px) { pre { font-size: 0.85rem; } }
|
|
162
41
|
</style>
|
|
163
42
|
</head>
|
|
164
43
|
<body>
|
|
165
44
|
|
|
45
|
+
<!-- Navigation -->
|
|
46
|
+
<nav class="navbar navbar-expand-lg navbar-dark sticky-top">
|
|
47
|
+
<div class="container">
|
|
48
|
+
<a class="navbar-brand" href="/"><i class="fas fa-code me-2"></i>MwalaJS</a>
|
|
49
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
50
|
+
<span class="navbar-toggler-icon"></span>
|
|
51
|
+
</button>
|
|
52
|
+
<div class="collapse navbar-collapse" id="navbarNav">
|
|
53
|
+
<ul class="navbar-nav ms-auto">
|
|
54
|
+
<li class="nav-item"><a class="nav-link" href="#overview"><i class="fas fa-info-circle"></i> Overview</a></li>
|
|
55
|
+
<li class="nav-item"><a class="nav-link" href="#installation"><i class="fas fa-download"></i> Installation</a></li>
|
|
56
|
+
<li class="nav-item"><a class="nav-link" href="#commands"><i class="fas fa-terminal"></i> Commands</a></li>
|
|
57
|
+
<li class="nav-item"><a class="nav-link" href="#structure"><i class="fas fa-folder-tree"></i> Structure</a></li>
|
|
58
|
+
<li class="nav-item"><a class="nav-link" href="#examples"><i class="fas fa-code"></i> Examples</a></li>
|
|
59
|
+
<li class="nav-item"><a class="nav-link" href="#downloads"><i class="fas fa-cloud-download-alt"></i> Downloads</a></li>
|
|
60
|
+
</ul>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</nav>
|
|
166
64
|
|
|
167
|
-
<div class="container">
|
|
168
|
-
<header class="text-center my-5">
|
|
169
|
-
<h1>MwalaJS Framework Documentation</h1>
|
|
170
|
-
<p class="lead">A lightweight, easy-to-use Node.js framework to create scalable web applications with MVC architecture and powerful built-in features.</p>
|
|
171
|
-
<p>GitHub Repository: <a href="https://github.com/mwala400/mwalajs" target="_blank">https://github.com/mwala400/mwalajs</a></p>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
</header>
|
|
175
|
-
|
|
176
|
-
<!-- Overview Section -->
|
|
177
|
-
<section id="overview">
|
|
178
|
-
<h2 class="section-title">1. Overview</h2>
|
|
179
|
-
<p>MwalaJS is a lightweight, easy-to-use Node.js framework designed to help you create scalable and organized MVC-based web applications. It comes with built-in features for handling routing, models, views, middleware, and database operations.</p>
|
|
180
|
-
<a href="files/documentation.pdf" download="documentation.pdf" class="text">
|
|
181
|
-
Download Documentation
|
|
182
|
-
</a>
|
|
183
|
-
|
|
184
|
-
<section id="release">
|
|
185
|
-
<br> <h2 class="section-title">1. VERSION RELEASE</h2>
|
|
186
|
-
<p>Click below to download the installer For Mwalajs framework:</p>
|
|
187
|
-
<br><a class="btn" href="https://mwalajs.biasharabora.com/files/mwalaJS_installer.exe" download>Download MwalaJS COMMAND SHELL (CLS) download .exe file here </a>
|
|
188
|
-
<br> <p>Click below to download zip file mwalajs framework:</p>
|
|
189
|
-
<br> <a class="btn" href="https://mwalajs.biasharabora.com/files/mwalajsm.zip" download>Download MwalaJS mwalajs.zip v1.0.0</a>
|
|
190
|
-
<br> <p>Click below to download rar file mwalajs framework :</p>
|
|
191
|
-
<br> <a class="btn" href="https://mwalajs.biasharabora.com/files/mwalajsm.rar" download>Download MwalaJS mwalajs.rar v1.0.0</a>
|
|
192
|
-
<pre>git clone https://github.com/mwala400/mwalajs.git</pre>
|
|
193
|
-
|
|
194
|
-
<br> <a class="btn" href="https://github.com/mwala400/mwalajs" target="_blank" download>Clone from github https://github.com/mwala400/mwalajs v1.0.0</a>
|
|
195
|
-
|
|
196
|
-
<br>
|
|
197
|
-
<br>
|
|
198
|
-
</section>
|
|
65
|
+
<div class="container my-5">
|
|
199
66
|
|
|
67
|
+
<header class="text-center mb-5">
|
|
68
|
+
<h1 class="display-4">MwalaJS Framework Documentation</h1>
|
|
69
|
+
<p class="lead">Lightweight Node.js MVC framework built on Express.js with powerful CLI tools, code scaffolding, database migrations, and EJS templating.</p>
|
|
70
|
+
<p>Latest Version: 1.0.5 | <a href="https://github.com/mwala400/mwalajs" target="_blank">GitHub Repository</a></p>
|
|
71
|
+
</header>
|
|
200
72
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<li><
|
|
208
|
-
<li><
|
|
73
|
+
<!-- Overview -->
|
|
74
|
+
<section id="overview" class="section-card">
|
|
75
|
+
<h2><i class="fas fa-eye me-2"></i>Overview</h2>
|
|
76
|
+
<p>MwalaJS is a modern, lightweight MVC framework for Node.js that simplifies building scalable web applications. It wraps Express.js with built-in MVC structure, CLI scaffolding, multi-database support (MySQL, PostgreSQL, SQLite, MongoDB), migrations, middleware, and EJS views.</p>
|
|
77
|
+
<h3>Key Features</h3>
|
|
78
|
+
<ul class="list-group">
|
|
79
|
+
<li class="list-group-item"><i class="fas fa-check text-success"></i> MVC Architecture with automatic scaffolding</li>
|
|
80
|
+
<li class="list-group-item"><i class="fas fa-check text-success"></i> Powerful CLI for project creation, code generation, and DB management</li>
|
|
81
|
+
<li class="list-group-item"><i class="fas fa-check text-success"></i> Built-in middleware (helmet, cors, session, compression)</li>
|
|
82
|
+
<li class="list-group-item"><i class="fas fa-check text-success"></i> EJS templating engine integration</li>
|
|
83
|
+
<li class="list-group-item"><i class="fas fa-check text-success"></i> Database migrations and multi-DB support</li>
|
|
84
|
+
<li class="list-group-item"><i class="fas fa-check text-success"></i> ES Modules (.mjs) and CommonJS (.js) compatibility</li>
|
|
209
85
|
</ul>
|
|
210
86
|
</section>
|
|
211
87
|
|
|
88
|
+
<!-- Installation -->
|
|
89
|
+
<section id="installation" class="section-card">
|
|
90
|
+
<h2><i class="fas fa-download me-2"></i>Installation</h2>
|
|
91
|
+
<p><strong>Recommended (Latest Versions ≥1.0.4):</strong> Install via NPM</p>
|
|
92
|
+
<pre><code>npm install -g mwalajs</code></pre>
|
|
93
|
+
<p>For project-specific use:</p>
|
|
94
|
+
<pre><code>npm install mwalajs</code></pre>
|
|
95
|
+
<p>Create <code>package.json</code> with <code>npm init</code> and ensure:</p>
|
|
96
|
+
<pre><code>{
|
|
97
|
+
"type": "module",
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"mwalajs": "^1.0.5"
|
|
100
|
+
}
|
|
101
|
+
}</code></pre>
|
|
102
|
+
|
|
103
|
+
<h3>Older Versions (≤1.0.2)</h3>
|
|
104
|
+
<p>Download .exe, .zip, or .rar from the website and follow manual setup (add to PATH on Windows or symlink on Linux).</p>
|
|
105
|
+
</section>
|
|
212
106
|
|
|
213
|
-
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
<script>hljs.highlightAll();</script>
|
|
223
|
-
<style>
|
|
224
|
-
body {
|
|
225
|
-
font-family: Arial, sans-serif;
|
|
226
|
-
background-color: #f8f9fa;
|
|
227
|
-
}
|
|
228
|
-
.section-title {
|
|
229
|
-
color: #007bff;
|
|
230
|
-
margin-top: 20px;
|
|
231
|
-
}
|
|
232
|
-
pre {
|
|
233
|
-
background: #272c34;
|
|
234
|
-
color: #fff;
|
|
235
|
-
padding: 15px;
|
|
236
|
-
border-radius: 5px;
|
|
237
|
-
}
|
|
238
|
-
.navbar {
|
|
239
|
-
background-color: #007bff;
|
|
240
|
-
}
|
|
241
|
-
.navbar-brand, .nav-link {
|
|
242
|
-
color: white !important;
|
|
243
|
-
}
|
|
244
|
-
.footer {
|
|
245
|
-
background: #007bff;
|
|
246
|
-
color: white;
|
|
247
|
-
text-align: center;
|
|
248
|
-
padding: 10px 0;
|
|
249
|
-
margin-top: 30px;
|
|
250
|
-
}
|
|
251
|
-
</style>
|
|
252
|
-
</head>
|
|
253
|
-
<body>
|
|
254
|
-
|
|
255
|
-
<!-- Navigation -->
|
|
256
|
-
<nav class="navbar navbar-expand-lg">
|
|
257
|
-
<div class="container">
|
|
258
|
-
<a class="navbar-brand" href="#">MwalaJS Docs</a>
|
|
259
|
-
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
260
|
-
<span class="navbar-toggler-icon"></span>
|
|
261
|
-
</button>
|
|
262
|
-
<div class="collapse navbar-collapse" id="navbarNav">
|
|
263
|
-
<ul class="navbar-nav ms-auto">
|
|
264
|
-
<li class="nav-item"><a class="nav-link" href="#example">Examples</a></li>
|
|
265
|
-
<li class="nav-item"><a class="nav-link" href="#conclusion">Conclusion</a></li>
|
|
266
|
-
</ul>
|
|
267
|
-
</div>
|
|
107
|
+
<!-- Commands -->
|
|
108
|
+
<section id="commands" class="section-card">
|
|
109
|
+
<h2><i class="fas fa-terminal me-2"></i>CLI Commands</h2>
|
|
110
|
+
<div class="row">
|
|
111
|
+
<div class="col-md-6">
|
|
112
|
+
<h4>General</h4>
|
|
113
|
+
<pre><code>mwala -v # Show version
|
|
114
|
+
mwala help # List commands
|
|
115
|
+
mwala create-project <name> # Create new project</code></pre>
|
|
268
116
|
</div>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const __dirname = path.dirname(__filename);
|
|
285
|
-
|
|
286
|
-
mwalajs.set('view engine', 'ejs');
|
|
287
|
-
mwalajs.set('views', path.join(__dirname, 'views'));
|
|
288
|
-
|
|
289
|
-
mwalajs.useStatic(path.join(__dirname, 'public'));
|
|
290
|
-
|
|
291
|
-
mwalajs.use('/', homeRoutes);
|
|
292
|
-
|
|
293
|
-
const port = process.env.PORT || 3000;
|
|
294
|
-
mwalajs.listen(port, () => {
|
|
295
|
-
console.log(`Server running on http://localhost:${port}`);
|
|
296
|
-
});
|
|
297
|
-
</code></pre>
|
|
298
|
-
|
|
299
|
-
<h3 class="section-title">homeRoutes.mjs</h3>
|
|
300
|
-
<p>Here is an example of the default <code>homeRoutes.mjs</code> file:</p>
|
|
301
|
-
<pre><code class="language-javascript">
|
|
302
|
-
import mwalajs from 'mwalajs';
|
|
303
|
-
import { homeController, Steps, welcome, about } from '../controllers/homeController.mjs';
|
|
304
|
-
|
|
305
|
-
const router = mwalajs.Router();
|
|
306
|
-
|
|
307
|
-
router.get('/', homeController.getHomePage);
|
|
308
|
-
router.get('/steps', Steps.getSteps);
|
|
309
|
-
router.get('/welcome', welcome.getwelcome);
|
|
310
|
-
router.get('/about', about.getabout);
|
|
311
|
-
|
|
312
|
-
export { router as homeRoutes };
|
|
313
|
-
</code></pre>
|
|
314
|
-
|
|
315
|
-
<h3 class="section-title">homeController.mjs</h3>
|
|
316
|
-
<p>Here is an example of the <code>homeController.mjs</code> file:</p>
|
|
317
|
-
<pre><code class="language-javascript">
|
|
318
|
-
export const homeController = {
|
|
319
|
-
getHomePage: (req, res) => {
|
|
320
|
-
res.render('index', { title: 'Welcome to MwalaJS MVC' });
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
export const Steps = {
|
|
325
|
-
getSteps: (req, res) => {
|
|
326
|
-
res.render('steps', { title: 'Steps in MwalaJS MVC' });
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
export const welcome = {
|
|
331
|
-
getwelcome: (req, res) => {
|
|
332
|
-
res.render('welcome', { title: 'Welcome to MwalaJS MVC' });
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
export const about = {
|
|
337
|
-
getabout: (req, res) => {
|
|
338
|
-
res.render('about', { title: 'About MwalaJS MVC' });
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
</code></pre>
|
|
342
|
-
</section>
|
|
343
|
-
|
|
344
|
-
<!-- Conclusion Section -->
|
|
345
|
-
<section id="conclusion">
|
|
346
|
-
<h2 class="section-title">6. Conclusion</h2>
|
|
347
|
-
<p>MwalaJS is designed to streamline the development of MVC-based applications with its easy-to-use commands for setting up projects, generating components, and managing the database.</p>
|
|
348
|
-
<p>For full documentation and to contribute, visit the <a href="https://github.com/mwala400/mwalajs" target="_blank">GitHub repository</a>.</p>
|
|
349
|
-
<h3>Summary of MwalaJS Commands</h3>
|
|
350
|
-
<pre><code>
|
|
351
|
-
General Commands:
|
|
352
|
-
- mwala -v | mwala --version → Show MwalaJS version.
|
|
353
|
-
- mwala help | mwala h → Show help message.
|
|
354
|
-
|
|
355
|
-
Project Management:
|
|
356
|
-
- mwala create-project → Create a new project.
|
|
357
|
-
- mwala init → Initialize MwalaJS.
|
|
358
|
-
|
|
359
|
-
Running the Application:
|
|
360
|
-
- mwala serve | mwala app.mjs → Start MwalaJS app.
|
|
361
|
-
|
|
362
|
-
Database Operations:
|
|
363
|
-
- mwala create-db → Create database from .env file.
|
|
364
|
-
- mwala migrate all → Run all pending migrations.
|
|
365
|
-
- mwala rollback all → Undo migration.
|
|
366
|
-
|
|
367
|
-
Code Generation:
|
|
368
|
-
- mwala generate model <name> → Create a model.
|
|
369
|
-
- mwala generate controller <name> → Create a controller.
|
|
370
|
-
- mwala generate route <name> → Create a route.
|
|
371
|
-
- mwala generate view <name> → Create a view.
|
|
372
|
-
|
|
373
|
-
To execute a command, use:
|
|
374
|
-
mwala <command>
|
|
375
|
-
</code></pre>
|
|
376
|
-
</section>
|
|
377
|
-
</div>
|
|
378
|
-
<h1>mwalajsm/ # Root directory</h1>
|
|
379
|
-
<pre>
|
|
380
|
-
mwalajsm/ # Root directory
|
|
381
|
-
│── app.mjs # Main application file
|
|
382
|
-
│── runMigrations.mjs # Handles database migrations
|
|
383
|
-
│── createProject.mjs # Script for creating new projects
|
|
384
|
-
│── setupMwalajs.mjs # Setup script for MwalaJS
|
|
385
|
-
│── start.bat # Batch script to start the server
|
|
386
|
-
│── setup.bat # Batch script for installation
|
|
387
|
-
│── setup.bash # Bash script for installation (Linux/macOS)
|
|
388
|
-
│── setup.sh # Another installation script
|
|
389
|
-
│── package.json # Dependencies and project metadata
|
|
390
|
-
│── package-lock.json # Dependency lock file
|
|
391
|
-
│── README.md # Documentation for MwalaJS
|
|
392
|
-
│── migrations/ # Database migration files
|
|
393
|
-
│── models/ # Database models
|
|
394
|
-
│── controllers/ # Handles application logic
|
|
395
|
-
│── routes/ # Defines API routes
|
|
396
|
-
│── middlewares/ # Custom middleware for authentication, logging, etc.
|
|
397
|
-
│── config/ # Configuration files (e.g., database, app settings)
|
|
398
|
-
│── public/ # Static assets like CSS, JavaScript, and images
|
|
399
|
-
│── views/ # Template views (if using server-side rendering)
|
|
400
|
-
│── mwalajs/ # Core framework files
|
|
401
|
-
│── dist/ # Compiled or built files
|
|
402
|
-
│── node_modules/ # Dependencies installed via npm
|
|
403
|
-
│── YOUR CREATED PROJECT/ # When run mwala create-project will request project name related files (clarify purpose)
|
|
404
|
-
│── installer/ # Installation-related files
|
|
405
|
-
│── installerimg.png # Image used during installation
|
|
406
|
-
│── mwalajs5.png # Framework branding/image
|
|
407
|
-
│── mwalajs4_RXv_icon.ico # Framework icons
|
|
408
|
-
│── mwalajs4_lyh_icon.ico # Another framework icon
|
|
409
|
-
│── mwalajsm.iss # Installer script for Windows
|
|
410
|
-
│── background.bmp # Background image (possibly for setup UI)
|
|
411
|
-
│── background.png # Another background image
|
|
412
|
-
│── bin/ # Executable files or scripts
|
|
413
|
-
This structure makes MwalaJS a well-organized and scalable framework. To make it even more convincing, you could add:
|
|
414
|
-
|
|
415
|
-
A "tests/" folder – To show built-in support for unit and integration tests.
|
|
416
|
-
A "docs/" folder – Dedicated to documentation with detailed guides.
|
|
417
|
-
A "scripts/" folder – For automation scripts instead of having them in the root directory.
|
|
418
|
-
A "logs/" folder – To store logs instead of scattering them.
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
```
|
|
422
|
-
</pre>
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
## Getting Started
|
|
426
|
-
<pre>
|
|
427
|
-
### Installation
|
|
428
|
-
1. **Install MwalaJS globally:**
|
|
429
|
-
```sh
|
|
430
|
-
npm install -g mwalajs
|
|
431
|
-
```
|
|
432
|
-
2. **Create a new project:**
|
|
433
|
-
```sh
|
|
434
|
-
mwalajs create myApp
|
|
435
|
-
cd myApp
|
|
436
|
-
npm install
|
|
437
|
-
```
|
|
438
|
-
3. **Run the development server:**
|
|
439
|
-
```sh
|
|
440
|
-
npm start
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
## Sample Code
|
|
444
|
-
A simple MwalaJS route example:
|
|
445
|
-
Your MwalaJS file structure is well-organized, but to make it more convincing for developers to switch, consider:
|
|
446
|
-
|
|
447
|
-
1. Clean File Structure Explanation
|
|
448
|
-
Here’s a structured breakdown:
|
|
449
|
-
</pre>
|
|
450
|
-
|
|
451
|
-
<h1>FOLDERS</h1>
|
|
452
|
-
<pre>
|
|
117
|
+
<div class="col-md-6">
|
|
118
|
+
<h4>Server & DB</h4>
|
|
119
|
+
<pre><code>mwala serve # Start dev server
|
|
120
|
+
mwala create-db # Create database
|
|
121
|
+
mwala migrate all # Run migrations
|
|
122
|
+
mwala rollback all # Undo migrations</code></pre>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<h4>Code Generation</h4>
|
|
126
|
+
<pre><code>mwala generate model <name>
|
|
127
|
+
mwala generate controller <name>
|
|
128
|
+
mwala generate route <name>
|
|
129
|
+
mwala generate view <name>
|
|
130
|
+
mwala generate midware <name></code></pre>
|
|
131
|
+
</section>
|
|
453
132
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
2. Why Developers Should Switch to MwalaJS
|
|
477
|
-
MwalaJS should highlight:
|
|
478
|
-
Better modular structure (prevents spaghetti code)
|
|
479
|
-
Built-in migrations & models (reduces DB setup time)
|
|
480
|
-
Simplified setup scripts (automates installation)
|
|
481
|
-
Performance optimizations (mention key tech choices)
|
|
482
|
-
Security-first approach (middleware for authentication, validation)
|
|
483
|
-
</pre>
|
|
133
|
+
<!-- Project Structure -->
|
|
134
|
+
<section id="structure" class="section-card">
|
|
135
|
+
<h2><i class="fas fa-folder-tree me-2"></i>Project Structure</h2>
|
|
136
|
+
<p>Main entry: <code>app.mjs</code> (must be .mjs). Other files can use .mjs or .js if needed.</p>
|
|
137
|
+
<div class="structure-tree">
|
|
138
|
+
mwalajs-project/<br>
|
|
139
|
+
├── app.mjs # Main app (Express wrapper - must be .mjs)<br>
|
|
140
|
+
├── migrations/ # DB migration files (.js or .mjs)<br>
|
|
141
|
+
├── models/ # Models (e.g., UserModel.js or .mjs)<br>
|
|
142
|
+
├── controllers/ # Controllers (e.g., UserController.js or .mjs)<br>
|
|
143
|
+
├── routes/ # Routes (e.g., userRoutes.js or .mjs)<br>
|
|
144
|
+
├── middlewares/ # Custom middleware (.js or .mjs)<br>
|
|
145
|
+
├── config/ # Config files (database.js, etc.)<br>
|
|
146
|
+
├── public/ # Static assets<br>
|
|
147
|
+
│ ├── css/<br>
|
|
148
|
+
│ ├── js/<br>
|
|
149
|
+
│ └── images/<br>
|
|
150
|
+
├── views/ # EJS templates (.ejs)<br>
|
|
151
|
+
├── package.json<br>
|
|
152
|
+
└── README.md
|
|
153
|
+
</div>
|
|
154
|
+
</section>
|
|
484
155
|
|
|
485
|
-
|
|
486
|
-
<
|
|
487
|
-
|
|
488
|
-
|
|
156
|
+
<!-- Code Examples -->
|
|
157
|
+
<section id="examples" class="section-card">
|
|
158
|
+
<h2><i class="fas fa-code me-2"></i>Code Examples</h2>
|
|
159
|
+
|
|
160
|
+
<h3>app.mjs (Main Entry - must be .mjs)</h3>
|
|
161
|
+
<pre><code class="language-javascript">import mwalajs from 'mwalajs';
|
|
162
|
+
import { homeRoutes } from './routes/homeRoutes.mjs';
|
|
163
|
+
import path from 'path';
|
|
164
|
+
import { fileURLToPath } from 'url';
|
|
165
|
+
|
|
166
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
167
|
+
const __dirname = path.dirname(__filename);
|
|
168
|
+
|
|
169
|
+
mwalajs.set('view engine', 'ejs');
|
|
170
|
+
mwalajs.set('views', path.join(__dirname, 'views'));
|
|
171
|
+
mwalajs.useStatic(path.join(__dirname, 'public'));
|
|
172
|
+
|
|
173
|
+
mwalajs.use('/', homeRoutes);
|
|
174
|
+
|
|
175
|
+
const port = process.env.PORT || 3000;
|
|
176
|
+
mwalajs.listen(port, () => {
|
|
177
|
+
console.log(`Server running on http://localhost:${port}`);
|
|
178
|
+
});</code></pre>
|
|
179
|
+
|
|
180
|
+
<h3>routes/homeRoutes.mjs (or .js)</h3>
|
|
181
|
+
<pre><code class="language-javascript">import mwalajs from 'mwalajs';
|
|
182
|
+
import { homeController } from '../controllers/homeController.mjs';
|
|
183
|
+
|
|
184
|
+
const router = mwalajs.Router();
|
|
185
|
+
|
|
186
|
+
router.get('/', homeController.getHomePage);
|
|
187
|
+
router.get('/about', homeController.getAbout);
|
|
188
|
+
|
|
189
|
+
export { router as homeRoutes };</code></pre>
|
|
190
|
+
|
|
191
|
+
<h3>controllers/homeController.mjs (or .js)</h3>
|
|
192
|
+
<pre><code class="language-javascript">export const homeController = {
|
|
193
|
+
getHomePage: (req, res) => {
|
|
194
|
+
res.render('index', { title: 'Welcome to MwalaJS' });
|
|
195
|
+
},
|
|
196
|
+
getAbout: (req, res) => {
|
|
197
|
+
res.render('about', { title: 'About Us' });
|
|
198
|
+
}
|
|
199
|
+
};</code></pre>
|
|
200
|
+
|
|
201
|
+
<h3>views/index.ejs (Example View)</h3>
|
|
202
|
+
<pre><code class="language-html"><!DOCTYPE html>
|
|
203
|
+
<html>
|
|
204
|
+
<head>
|
|
205
|
+
<title><%= title %></title>
|
|
206
|
+
</head>
|
|
207
|
+
<body>
|
|
208
|
+
<h1><%= title %></h1>
|
|
209
|
+
<p>Welcome to your MwalaJS application!</p>
|
|
210
|
+
</body>
|
|
211
|
+
</html></code></pre>
|
|
212
|
+
</section>
|
|
489
213
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
214
|
+
<!-- Downloads -->
|
|
215
|
+
<section id="downloads" class="section-card">
|
|
216
|
+
<h2><i class="fas fa-cloud-download-alt me-2"></i>Downloads (Older Versions)</h2>
|
|
217
|
+
<div class="row text-center">
|
|
218
|
+
<div class="col-md-4 mb-3">
|
|
219
|
+
<a href="https://mwalajs.biasharabora.com/files/mwalaJS_installer.exe" class="btn btn-success btn-lg"><i class="fas fa-download"></i> .exe Installer</a>
|
|
220
|
+
</div>
|
|
221
|
+
<div class="col-md-4 mb-3">
|
|
222
|
+
<a href="https://mwalajs.biasharabora.com/files/mwalajsm.zip" class="btn btn-primary btn-lg"><i class="fas fa-download"></i> .zip (v1.0.0)</a>
|
|
223
|
+
</div>
|
|
224
|
+
<div class="col-md-4 mb-3">
|
|
225
|
+
<a href="https://mwalajs.biasharabora.com/files/mwalajsm.rar" class="btn btn-info btn-lg"><i class="fas fa-download"></i> .rar (v1.0.0)</a>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</section>
|
|
495
229
|
|
|
496
|
-
|
|
497
|
-
## Contribute <br>
|
|
498
|
-
We welcome contributors! Feel free to fork the repository, submit issues, and make pull requests.
|
|
499
|
-
<br><br>
|
|
500
|
-
## License <br>
|
|
501
|
-
MwalaJS is open-source and licensed under the MIT License.
|
|
502
|
-
<br>
|
|
230
|
+
</div>
|
|
503
231
|
|
|
232
|
+
<!-- Footer -->
|
|
504
233
|
|
|
505
234
|
|
|
235
|
+
<!-- Bootstrap JS -->
|
|
236
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
237
|
+
</body>
|
|
238
|
+
</html>
|
|
506
239
|
|
|
507
|
-
|
|
508
|
-
<div class="footer">
|
|
509
|
-
© 2025 MwalaJS Documentation | All Rights Reserved
|
|
510
|
-
</div>
|
|
511
|
-
|
|
512
|
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
513
|
-
</body>
|
|
514
|
-
</html>
|
|
240
|
+
<%- include('partials/footer') %>
|