mwalajs 1.0.6 → 1.0.8
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/{ujasi/bin/mwala.mjs → bin/mwala copy.mjs } +45 -9
- package/bin/mwala.mjs +215 -100
- package/config/createdatabase copy.mjs +362 -0
- package/config/createdatabase.mjs +85 -38
- package/package.json +2 -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 +124 -0
- package/views/about.ejs +271 -136
- package/views/index.ejs +396 -494
- 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/ujasi/README.md +0 -542
- package/ujasi/app.mjs +0 -33
- package/ujasi/bin/backupnewclean.js +0 -162
- package/ujasi/config/createTablesetdb.mjs +0 -38
- package/ujasi/config/createdatabase.mjs +0 -156
- package/ujasi/config/serverConfig.mjs +0 -1
- package/ujasi/controllers/fileController.mjs +0 -15
- package/ujasi/controllers/homeController.mjs +0 -28
- package/ujasi/models/exampleModel.mjs +0 -5
- package/ujasi/mwalajs/index.js +0 -109
- package/ujasi/mwalajs/index.mjs +0 -121
- package/ujasi/mwalajs/package.json +0 -16
- package/ujasi/package.json +0 -58
- package/ujasi/public/styles.css +0 -115
- package/ujasi/routes/homeRoutes.mjs +0 -12
- package/ujasi/runMigrations.mjs +0 -137
- package/ujasi/setupMwalajs.mjs +0 -58
- package/ujasi/views/about.ejs +0 -159
- package/ujasi/views/index.ejs +0 -227
- package/ujasi/views/sitemap.xml +0 -1
- package/ujasi/views/steps.ejs +0 -514
- package/ujasi/views/welcome.ejs +0 -257
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!-- views/partials/footer.ejs -->
|
|
2
|
+
<footer class="site-footer">
|
|
3
|
+
<div class="container">
|
|
4
|
+
<div class="row">
|
|
5
|
+
<div class="col-lg-4 col-md-6 mb-4">
|
|
6
|
+
<h5><i class="fas fa-code me-2"></i>MwalaJS Framework</h5>
|
|
7
|
+
<p>High-performance Node.js MVC framework for modern web applications.</p>
|
|
8
|
+
<p class="text-muted small">
|
|
9
|
+
Built with ❤️ by <strong>Hekima Ambalile Mwala</strong>
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="col-lg-2 col-md-3 col-sm-6 mb-4">
|
|
14
|
+
<h6>Quick Links</h6>
|
|
15
|
+
<ul class="list-unstyled">
|
|
16
|
+
<li><a href="/">Home</a></li>
|
|
17
|
+
<li><a href="/mwalajs-framework-documentation">Documentation</a></li>
|
|
18
|
+
<li><a href="/about">About</a></li>
|
|
19
|
+
<li><a href="https://github.com/mwala400/mwalajs">GitHub</a></li>
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="col-lg-2 col-md-3 col-sm-6 mb-4">
|
|
24
|
+
<h6>Community</h6>
|
|
25
|
+
<ul class="list-unstyled">
|
|
26
|
+
<li><a href="https://chat.whatsapp.com/F8x1p8R1EhZ5b7RX7PO6dR" target="_blank">WhatsApp Group</a></li>
|
|
27
|
+
<li><a href="https://youtube.com/@hekimamwala" target="_blank">YouTube Channel</a></li>
|
|
28
|
+
</ul>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="col-lg-4 col-md-6 mb-4 text-lg-end">
|
|
32
|
+
<h6>Contact</h6>
|
|
33
|
+
<p>
|
|
34
|
+
<i class="fas fa-envelope me-2"></i>
|
|
35
|
+
<a href="mailto:biasharaboraofficials@gmail.com">biasharaboraofficials@gmail.com</a>
|
|
36
|
+
</p>
|
|
37
|
+
<p>
|
|
38
|
+
<i class="fas fa-phone me-2"></i>
|
|
39
|
+
<a href="tel:+255747285438">+255 747 285 438</a>
|
|
40
|
+
</p>
|
|
41
|
+
<div class="social-links mt-3">
|
|
42
|
+
<a href="https://github.com/mwala400/mwalajs" target="_blank" class="me-3"><i class="fab fa-github fa-2x"></i></a>
|
|
43
|
+
<a href="https://youtube.com/@hekimamwala" target="_blank" class="me-3"><i class="fab fa-youtube fa-2x"></i></a>
|
|
44
|
+
<a href="https://chat.whatsapp.com/F8x1p8R1EhZ5b7RX7PO6dR" target="_blank"><i class="fab fa-whatsapp fa-2x"></i></a>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<hr class="my-4 border-secondary">
|
|
50
|
+
|
|
51
|
+
<div class="text-center">
|
|
52
|
+
<p class="mb-0">
|
|
53
|
+
© <span id="currentYear"></span> MwalaJS Framework. All rights reserved.
|
|
54
|
+
<br>
|
|
55
|
+
<small class="text-muted">Made in Tanzania with passion for open-source</small>
|
|
56
|
+
</p>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</footer>
|
|
60
|
+
|
|
61
|
+
<style>
|
|
62
|
+
.site-footer {
|
|
63
|
+
background: linear-gradient(135deg, #1e3c72, #15294f);
|
|
64
|
+
color: white;
|
|
65
|
+
padding: 4rem 0 2rem;
|
|
66
|
+
margin-top: 5rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.site-footer a {
|
|
70
|
+
color: rgba(255,255,255,0.8);
|
|
71
|
+
text-decoration: none;
|
|
72
|
+
transition: color 0.3s ease;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.site-footer a:hover {
|
|
76
|
+
color: #ffc107;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.site-footer h5, .site-footer h6 {
|
|
80
|
+
color: white;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
margin-bottom: 1.5rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.social-links a {
|
|
86
|
+
color: white;
|
|
87
|
+
transition: transform 0.3s ease;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.social-links a:hover {
|
|
91
|
+
transform: translateY(-5px);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
hr.border-secondary {
|
|
95
|
+
opacity: 0.3;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
98
|
+
|
|
99
|
+
<script>
|
|
100
|
+
// Dynamic year
|
|
101
|
+
document.getElementById('currentYear').textContent = new Date().getFullYear();
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<!-- views/partials/header.ejs - Responsive Top Navbar (expands/contracts on all devices) -->
|
|
2
|
+
<header class="site-header">
|
|
3
|
+
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
|
|
4
|
+
<div class="container-fluid">
|
|
5
|
+
<!-- Brand Logo -->
|
|
6
|
+
<a class="navbar-brand fw-bold" href="/">
|
|
7
|
+
<i class="fas fa-code me-2"></i>
|
|
8
|
+
<span class="brand-text">MwalaJS</span>
|
|
9
|
+
</a>
|
|
10
|
+
|
|
11
|
+
<!-- Mobile Toggle Button -->
|
|
12
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNavbar"
|
|
13
|
+
aria-controls="mainNavbar" aria-expanded="false" aria-label="Toggle navigation">
|
|
14
|
+
<span class="navbar-toggler-icon"></span>
|
|
15
|
+
</button>
|
|
16
|
+
|
|
17
|
+
<!-- Collapsible Navigation Links -->
|
|
18
|
+
<div class="collapse navbar-collapse" id="mainNavbar">
|
|
19
|
+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
|
20
|
+
<li class="nav-item">
|
|
21
|
+
<a class="nav-link <%= (typeof currentPath !== 'undefined' ? currentPath : '/') === '/' ? 'active' : '' %>"
|
|
22
|
+
href="/">Home</a>
|
|
23
|
+
</li>
|
|
24
|
+
|
|
25
|
+
<li class="nav-item">
|
|
26
|
+
<a class="nav-link <%= (typeof currentPath !== 'undefined' && currentPath.includes('documentation')) ? 'active' : '' %>"
|
|
27
|
+
href="/mwalajs-framework-documentation">Documentation</a>
|
|
28
|
+
</li>
|
|
29
|
+
|
|
30
|
+
<li class="nav-item dropdown">
|
|
31
|
+
<a class="nav-link dropdown-toggle <%= (typeof currentPath !== 'undefined' && (currentPath.includes('/steps') || currentPath.includes('/welcome'))) ? 'active' : '' %>"
|
|
32
|
+
href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
33
|
+
Getting Started
|
|
34
|
+
</a>
|
|
35
|
+
<ul class="dropdown-menu">
|
|
36
|
+
<li><a class="dropdown-item" href="/steps">Step-by-Step Guide</a></li>
|
|
37
|
+
<li><a class="dropdown-item" href="/welcome">Welcome Page</a></li>
|
|
38
|
+
<li><hr class="dropdown-divider"></li>
|
|
39
|
+
<li><a class="dropdown-item" href="/mwalajs-framework-documentation#installation">Installation</a></li>
|
|
40
|
+
<li><a class="dropdown-item" href="/mwalajs-framework-documentation#commands">CLI Commands</a></li>
|
|
41
|
+
<li><a class="dropdown-item" href="/mwalajs-framework-documentation#structure">Project Structure</a></li>
|
|
42
|
+
</ul>
|
|
43
|
+
</li>
|
|
44
|
+
|
|
45
|
+
<li class="nav-item dropdown">
|
|
46
|
+
<a class="nav-link dropdown-toggle <%= (typeof currentPath !== 'undefined' && currentPath.includes('/examples')) ? 'active' : '' %>"
|
|
47
|
+
href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
48
|
+
Guides & Examples
|
|
49
|
+
</a>
|
|
50
|
+
<ul class="dropdown-menu">
|
|
51
|
+
<li><a class="dropdown-item" href="/mwalajs-framework-documentation#examples">Code Examples</a></li>
|
|
52
|
+
<li><a class="dropdown-item" href="/steps">Tutorial</a></li>
|
|
53
|
+
</ul>
|
|
54
|
+
</li>
|
|
55
|
+
|
|
56
|
+
<li class="nav-item">
|
|
57
|
+
<a class="nav-link <%= (typeof currentPath !== 'undefined' && currentPath === '/about') ? 'active' : '' %>"
|
|
58
|
+
href="/about">About Us</a>
|
|
59
|
+
</li>
|
|
60
|
+
</ul>
|
|
61
|
+
|
|
62
|
+
<!-- Right Side Links (Community & GitHub) -->
|
|
63
|
+
<ul class="navbar-nav ms-auto">
|
|
64
|
+
<li class="nav-item">
|
|
65
|
+
<a class="nav-link" href="https://github.com/mwala400/mwalajs" target="_blank">
|
|
66
|
+
<i class="fab fa-github me-2"></i>GitHub
|
|
67
|
+
</a>
|
|
68
|
+
</li>
|
|
69
|
+
<li class="nav-item">
|
|
70
|
+
<a class="nav-link text-success" href="https://chat.whatsapp.com/F8x1p8R1EhZ5b7RX7PO6dR?mode=r_t" target="_blank">
|
|
71
|
+
<i class="fab fa-whatsapp me-2"></i>Community
|
|
72
|
+
</a>
|
|
73
|
+
</li>
|
|
74
|
+
</ul>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</nav>
|
|
78
|
+
</header>
|
|
79
|
+
|
|
80
|
+
<style>
|
|
81
|
+
.site-header {
|
|
82
|
+
background: linear-gradient(135deg, #1e3c72, #2a5298);
|
|
83
|
+
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.navbar-brand {
|
|
87
|
+
font-size: 1.6rem;
|
|
88
|
+
font-weight: 800;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.brand-text {
|
|
92
|
+
margin-left: 0.5rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.nav-link {
|
|
96
|
+
font-weight: 500;
|
|
97
|
+
padding: 0.8rem 1.2rem !important;
|
|
98
|
+
transition: all 0.3s ease;
|
|
99
|
+
border-radius: 8px;
|
|
100
|
+
margin: 0 0.3rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.nav-link:hover {
|
|
104
|
+
background: rgba(255,255,255,0.15);
|
|
105
|
+
color: #ffc107 !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.nav-link.active {
|
|
109
|
+
background: rgba(255,255,255,0.25);
|
|
110
|
+
color: #ffc107 !important;
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Dropdown menu improvements */
|
|
115
|
+
.dropdown-menu {
|
|
116
|
+
background: #15294f;
|
|
117
|
+
border: none;
|
|
118
|
+
box-shadow: 0 8px 25px rgba(0,0,0,0.4);
|
|
119
|
+
border-radius: 10px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.dropdown-item {
|
|
123
|
+
color: rgba(255,255,255,0.9);
|
|
124
|
+
padding: 0.7rem 1.5rem;
|
|
125
|
+
transition: all 0.3s ease;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.dropdown-item:hover {
|
|
129
|
+
background: rgba(13,110,253,0.4);
|
|
130
|
+
color: white;
|
|
131
|
+
padding-left: 1.8rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Mobile adjustments */
|
|
135
|
+
@media (max-width: 992px) {
|
|
136
|
+
.navbar-collapse {
|
|
137
|
+
background: rgba(21,41,79,0.95);
|
|
138
|
+
margin-top: 1rem;
|
|
139
|
+
padding: 1rem;
|
|
140
|
+
border-radius: 10px;
|
|
141
|
+
backdrop-filter: blur(10px);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.navbar-nav .nav-link {
|
|
145
|
+
padding: 0.8rem 1rem !important;
|
|
146
|
+
border-radius: 8px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.navbar-nav.ms-auto {
|
|
150
|
+
margin-top: 1rem;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* Extra small devices */
|
|
155
|
+
@media (max-width: 576px) {
|
|
156
|
+
.navbar-brand {
|
|
157
|
+
font-size: 1.4rem;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
</style>
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>MwalaJS Framework Documentation</title>
|
|
7
|
+
|
|
8
|
+
<!-- Bootstrap 5 CSS -->
|
|
9
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
10
|
+
|
|
11
|
+
<!-- Font Awesome for Icons -->
|
|
12
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
13
|
+
|
|
14
|
+
<!-- Highlight.js for Code Syntax Highlighting -->
|
|
15
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
|
|
16
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
|
17
|
+
<script>hljs.highlightAll();</script>
|
|
18
|
+
|
|
19
|
+
<!-- Meta Tags -->
|
|
20
|
+
<meta name="description" content="MwalaJS Framework Documentation - Lightweight Node.js MVC framework with CLI tools, database migrations, and EJS templating.">
|
|
21
|
+
<meta name="keywords" content="MwalaJS, Node.js, MVC, JavaScript framework, EJS, documentation">
|
|
22
|
+
<meta name="author" content="Hekima Ambalile Mwala">
|
|
23
|
+
<meta property="og:title" content="MwalaJS Framework Documentation">
|
|
24
|
+
<meta property="og:description" content="Complete guide to MwalaJS: installation, commands, project structure, examples, and more.">
|
|
25
|
+
<meta property="og:url" content="https://mwalajs.biasharabora.com">
|
|
26
|
+
<meta property="og:image" content="https://mwalajs.biasharabora.com/images/mwala-logo.png">
|
|
27
|
+
|
|
28
|
+
<!-- Custom Styles -->
|
|
29
|
+
<style>
|
|
30
|
+
:root {
|
|
31
|
+
--primary: #0d6efd;
|
|
32
|
+
--accent-gradient: linear-gradient(135deg, #0d6efd, #6610f2);
|
|
33
|
+
}
|
|
34
|
+
body { background-color: #f8f9fa; font-family: 'Segoe UI', sans-serif; }
|
|
35
|
+
.navbar { background: var(--accent-gradient) !important; }
|
|
36
|
+
.nav-link { color: white !important; }
|
|
37
|
+
.nav-link:hover { color: #ffc107 !important; }
|
|
38
|
+
pre code { background: #1e1e1e; padding: 1.5rem; border-radius: 12px; }
|
|
39
|
+
.section-card { background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 6px 15px rgba(0,0,0,0.08); margin-bottom: 2rem; }
|
|
40
|
+
footer { background: var(--accent-gradient); color: white; padding: 2rem 0; text-align: center; }
|
|
41
|
+
.btn-primary { background: var(--primary); border: none; }
|
|
42
|
+
.structure-tree { font-family: monospace; white-space: pre; background: #f1f1f1; padding: 1rem; border-radius: 8px; }
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
<!-- Navbar -->
|
|
48
|
+
<nav class="navbar navbar-expand-lg navbar-dark">
|
|
49
|
+
<div class="container">
|
|
50
|
+
<a class="navbar-brand" href="/"><i class="fas fa-code me-2"></i>MwalaJS</a>
|
|
51
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
52
|
+
<span class="navbar-toggler-icon"></span>
|
|
53
|
+
</button>
|
|
54
|
+
<div class="collapse navbar-collapse" id="navbarNav">
|
|
55
|
+
<ul class="navbar-nav ms-auto">
|
|
56
|
+
<li class="nav-item"><a class="nav-link" href="#overview"><i class="fas fa-info-circle"></i> Overview</a></li>
|
|
57
|
+
<li class="nav-item"><a class="nav-link" href="#installation"><i class="fas fa-download"></i> Installation</a></li>
|
|
58
|
+
<li class="nav-item"><a class="nav-link" href="#commands"><i class="fas fa-terminal"></i> Commands</a></li>
|
|
59
|
+
<li class="nav-item"><a class="nav-link" href="#structure"><i class="fas fa-folder-tree"></i> Structure</a></li>
|
|
60
|
+
<li class="nav-item"><a class="nav-link" href="#examples"><i class="fas fa-code-branch"></i> Examples</a></li>
|
|
61
|
+
<li class="nav-item"><a class="nav-link" href="#conclusion"><i class="fas fa-check-circle"></i> Conclusion</a></li>
|
|
62
|
+
</ul>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</nav>
|
|
66
|
+
|
|
67
|
+
<div class="container my-5">
|
|
68
|
+
|
|
69
|
+
<header class="text-center my-5">
|
|
70
|
+
<h1 class="display-4"><i class="fas fa-book-open me-3"></i>MwalaJS Framework Documentation</h1>
|
|
71
|
+
<p class="lead">Lightweight MVC Node.js framework with CLI scaffolding, database migrations, and EJS views.</p>
|
|
72
|
+
<p>GitHub: <a href="https://github.com/mwala400/mwalajs" target="_blank">https://github.com/mwala400/mwalajs</a></p>
|
|
73
|
+
</header>
|
|
74
|
+
|
|
75
|
+
<!-- Overview -->
|
|
76
|
+
<section id="overview" class="section-card">
|
|
77
|
+
<h2><i class="fas fa-eye me-2"></i>Overview</h2>
|
|
78
|
+
<p>MwalaJS is a lightweight, modular Node.js framework following the MVC pattern. It includes built-in CLI for project setup, code generation, database management, and server running.</p>
|
|
79
|
+
<h3>Key Features</h3>
|
|
80
|
+
<ul>
|
|
81
|
+
<li>MVC Architecture</li>
|
|
82
|
+
<li>CLI Code Generation (models, controllers, routes, views, middleware)</li>
|
|
83
|
+
<li>Database Commands & Migrations</li>
|
|
84
|
+
<li>EJS Template Engine Integration</li>
|
|
85
|
+
<li>Static File Serving</li>
|
|
86
|
+
<li>Support for .mjs (ES modules) and fallback to .js</li>
|
|
87
|
+
</ul>
|
|
88
|
+
</section>
|
|
89
|
+
|
|
90
|
+
<!-- Installation & Releases -->
|
|
91
|
+
<section id="installation" class="section-card">
|
|
92
|
+
<h2><i class="fas fa-download me-2"></i>Installation & Releases</h2>
|
|
93
|
+
<p>Latest versions are available via NPM. Older versions via direct downloads.</p>
|
|
94
|
+
|
|
95
|
+
<h3>NPM Installation (Recommended for v1.0.4+)</h3>
|
|
96
|
+
<pre><code class="language-bash">npm install -g mwalajs</code></pre>
|
|
97
|
+
|
|
98
|
+
<h3>Direct Downloads (Older Versions)</h3>
|
|
99
|
+
<div class="row">
|
|
100
|
+
<div class="col-md-4 mb-3">
|
|
101
|
+
<a href="https://mwalajs.biasharabora.com/files/mwalaJS_installer.exe" class="btn btn-success btn-lg d-block"><i class="fas fa-file-archive"></i> .EXE Installer</a>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="col-md-4 mb-3">
|
|
104
|
+
<a href="https://mwalajs.biasharabora.com/files/mwalajsm.zip" class="btn btn-primary btn-lg d-block"><i class="fas fa-file-zipper"></i> .ZIP (v1.0.0)</a>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="col-md-4 mb-3">
|
|
107
|
+
<a href="https://mwalajs.biasharabora.com/files/mwalajsm.rar" class="btn btn-info btn-lg d-block"><i class="fas fa-file-archive"></i> .RAR (v1.0.0)</a>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<p>GitHub Clone:</p>
|
|
112
|
+
<pre><code class="language-bash">git clone https://github.com/mwala400/mwalajs.git</code></pre>
|
|
113
|
+
</section>
|
|
114
|
+
|
|
115
|
+
<!-- Commands -->
|
|
116
|
+
<section id="commands" class="section-card">
|
|
117
|
+
<h2><i class="fas fa-terminal me-2"></i>CLI Commands</h2>
|
|
118
|
+
<pre><code class="language-bash">
|
|
119
|
+
mwala create-project <projectName> # Create new project
|
|
120
|
+
mwala init # Initialize in existing project
|
|
121
|
+
mwala serve # Start server (or node app.mjs)
|
|
122
|
+
|
|
123
|
+
Database:
|
|
124
|
+
mwala create-db
|
|
125
|
+
mwala create-table <name>
|
|
126
|
+
mwala drop-table <name>
|
|
127
|
+
mwala migrate all
|
|
128
|
+
mwala rollback all
|
|
129
|
+
|
|
130
|
+
Generation:
|
|
131
|
+
mwala generate model <name>
|
|
132
|
+
mwala generate controller <name>
|
|
133
|
+
mwala generate route <name>
|
|
134
|
+
mwala generate view <name>
|
|
135
|
+
mwala generate midware <name>
|
|
136
|
+
|
|
137
|
+
Other:
|
|
138
|
+
mwala -v # Version
|
|
139
|
+
mwala help # Help
|
|
140
|
+
</code></pre>
|
|
141
|
+
</section>
|
|
142
|
+
|
|
143
|
+
<!-- Project Structure -->
|
|
144
|
+
<section id="structure" class="section-card">
|
|
145
|
+
<h2><i class="fas fa-folder-tree me-2"></i>Project Structure</h2>
|
|
146
|
+
<p>Main entry: <strong>app.mjs</strong> (must be .mjs). Other files can use .mjs or .js.</p>
|
|
147
|
+
<pre class="structure-tree">
|
|
148
|
+
mwalajs-project/
|
|
149
|
+
├── app.mjs # Main entry point (required .mjs)
|
|
150
|
+
├── migrations/ # Database migrations
|
|
151
|
+
├── models/ # Models (.mjs or .js)
|
|
152
|
+
├── controllers/ # Controllers (.mjs or .js)
|
|
153
|
+
├── routes/ # Routes (.mjs or .js)
|
|
154
|
+
├── middlewares/ # Middleware (.mjs or .js)
|
|
155
|
+
├── config/ # Config files
|
|
156
|
+
├── public/ # Static assets
|
|
157
|
+
│ ├── css/
|
|
158
|
+
│ ├── js/
|
|
159
|
+
│ └── images/
|
|
160
|
+
├── views/ # EJS templates (.ejs)
|
|
161
|
+
├── package.json
|
|
162
|
+
└── README.md
|
|
163
|
+
</pre>
|
|
164
|
+
</section>
|
|
165
|
+
|
|
166
|
+
<!-- Examples -->
|
|
167
|
+
<section id="examples" class="section-card">
|
|
168
|
+
<h2><i class="fas fa-code-branch me-2"></i>Code Examples</h2>
|
|
169
|
+
|
|
170
|
+
<h3>app.mjs (or app.js)</h3>
|
|
171
|
+
<pre><code class="language-javascript">
|
|
172
|
+
import mwalajs from 'mwalajs';
|
|
173
|
+
import { homeRoutes } from './routes/homeRoutes.mjs'; // or .js
|
|
174
|
+
import path from 'path';
|
|
175
|
+
import { fileURLToPath } from 'url';
|
|
176
|
+
|
|
177
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
178
|
+
const __dirname = path.dirname(__filename);
|
|
179
|
+
|
|
180
|
+
mwalajs.set('view engine', 'ejs');
|
|
181
|
+
mwalajs.set('views', path.join(__dirname, 'views'));
|
|
182
|
+
mwalajs.useStatic(path.join(__dirname, 'public'));
|
|
183
|
+
|
|
184
|
+
mwalajs.use('/', homeRoutes);
|
|
185
|
+
|
|
186
|
+
const port = process.env.PORT || 3000;
|
|
187
|
+
mwalajs.listen(port, () => {
|
|
188
|
+
console.log(`Server running on http://localhost:${port}`);
|
|
189
|
+
});
|
|
190
|
+
</code></pre>
|
|
191
|
+
|
|
192
|
+
<h3>routes/homeRoutes.mjs (or .js)</h3>
|
|
193
|
+
<pre><code class="language-javascript">
|
|
194
|
+
import mwalajs from 'mwalajs';
|
|
195
|
+
import { homeController } from '../controllers/homeController.mjs'; // or .js
|
|
196
|
+
|
|
197
|
+
const router = mwalajs.Router();
|
|
198
|
+
|
|
199
|
+
router.get('/', homeController.getHomePage);
|
|
200
|
+
// Add more routes...
|
|
201
|
+
|
|
202
|
+
export { router as homeRoutes };
|
|
203
|
+
</code></pre>
|
|
204
|
+
|
|
205
|
+
<h3>controllers/homeController.mjs (or .js)</h3>
|
|
206
|
+
<pre><code class="language-javascript">
|
|
207
|
+
export const homeController = {
|
|
208
|
+
getHomePage: (req, res) => {
|
|
209
|
+
res.render('index', { title: 'Welcome to MwalaJS' });
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
</code></pre>
|
|
213
|
+
|
|
214
|
+
<h3>views/index.ejs (Example View)</h3>
|
|
215
|
+
<pre><code class="language-html">
|
|
216
|
+
<!DOCTYPE html>
|
|
217
|
+
<html lang="en">
|
|
218
|
+
<head>
|
|
219
|
+
<title><%= title %></title>
|
|
220
|
+
</head>
|
|
221
|
+
<body>
|
|
222
|
+
<h1><%= title %></h1>
|
|
223
|
+
<p>This is rendered with EJS in MwalaJS!</p>
|
|
224
|
+
</body>
|
|
225
|
+
</html>
|
|
226
|
+
</code></pre>
|
|
227
|
+
</section>
|
|
228
|
+
|
|
229
|
+
<!-- Conclusion -->
|
|
230
|
+
<section id="conclusion" class="section-card">
|
|
231
|
+
<h2><i class="fas fa-check-circle me-2"></i>Conclusion</h2>
|
|
232
|
+
<p>MwalaJS simplifies Node.js MVC development with powerful CLI tools and clean structure. Start building scalable apps today!</p>
|
|
233
|
+
<p>License: MIT © 2025 Hekima Ambalile Mwala</p>
|
|
234
|
+
</section>
|
|
235
|
+
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
<!-- Bootstrap JS -->
|
|
241
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
242
|
+
</body>
|
|
243
|
+
</html>
|