baraqex 1.0.47 → 1.0.49
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/dist/index.js +236 -189
- package/dist/index.js.map +4 -4
- package/dist/server.js +1282 -864
- package/dist/server.js.map +4 -4
- package/package.json +1 -1
- package/templates/fullstack-template/package-lock.json +931 -4
- package/templates/fullstack-template/package.json +7 -5
- package/templates/fullstack-template/server.js +548 -15
- package/templates/fullstack-template/src/api/hello.js +9 -11
- package/templates/fullstack-template/src/pages/index.js +196 -114
- package/templates/fullstack-app/package-lock.json +0 -3683
- package/templates/fullstack-app/package.json +0 -26
- package/templates/fullstack-app/public/client.js +0 -139
- package/templates/fullstack-app/public/fullstack-styles.css +0 -445
- package/templates/fullstack-app/server.js +0 -32
- package/templates/fullstack-app/src/api/auth.js +0 -48
- package/templates/fullstack-app/src/api/users.js +0 -85
- package/templates/fullstack-app/src/pages/index.js +0 -0
- package/templates/fullstack-app/src/pages/index.jsx +0 -181
- package/templates/fullstack-app/src/pages/login.js +0 -139
- package/templates/fullstack-app/src/pages/login.jsx +0 -150
- package/templates/fullstack-template/public/client.js +0 -17
- package/templates/fullstack-template/src/api/users/index.js +0 -43
- package/templates/go-wasm-app/package.json +0 -24
- package/templates/go-wasm-app/public/wasm-styles.css +0 -184
- package/templates/go-wasm-app/server.js +0 -36
- package/templates/go-wasm-app/src/pages/index.jsx +0 -161
- package/templates/go-wasm-app/src/wasm/main.go +0 -164
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "baraqex-fullstack-app",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Full-stack Baraqex application with API and database",
|
|
6
|
-
"main": "server.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"dev": "node server.js",
|
|
9
|
-
"build": "npm run build:server && npm run build:client",
|
|
10
|
-
"build:server": "echo 'Building server...'",
|
|
11
|
-
"build:client": "echo 'Building client...'",
|
|
12
|
-
"start": "NODE_ENV=production node server.js",
|
|
13
|
-
"test": "node test.js",
|
|
14
|
-
"migrate": "node scripts/migrate.js"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"baraqex": "^1.0.22",
|
|
18
|
-
"bcryptjs": "^2.4.3",
|
|
19
|
-
"express": "^4.18.2",
|
|
20
|
-
"frontend-hamroun": "^1.2.35",
|
|
21
|
-
"jsonwebtoken": "^9.0.0"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"typescript": "^5.0.0"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// Simple client-side hydration script for Baraqex fullstack app
|
|
2
|
-
|
|
3
|
-
console.log('🚀 Baraqex client-side script loaded');
|
|
4
|
-
|
|
5
|
-
// Add interactive functionality
|
|
6
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
7
|
-
console.log('📱 Client-side hydration starting...');
|
|
8
|
-
|
|
9
|
-
// Add smooth scrolling to anchor links
|
|
10
|
-
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
|
11
|
-
anchor.addEventListener('click', function (e) {
|
|
12
|
-
e.preventDefault();
|
|
13
|
-
const target = document.querySelector(this.getAttribute('href'));
|
|
14
|
-
if (target) {
|
|
15
|
-
target.scrollIntoView({
|
|
16
|
-
behavior: 'smooth'
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// Add form enhancements
|
|
23
|
-
const forms = document.querySelectorAll('form');
|
|
24
|
-
forms.forEach(form => {
|
|
25
|
-
form.addEventListener('submit', function(e) {
|
|
26
|
-
const submitBtn = form.querySelector('button[type="submit"]');
|
|
27
|
-
if (submitBtn && !submitBtn.disabled) {
|
|
28
|
-
// Add loading state
|
|
29
|
-
const originalText = submitBtn.textContent;
|
|
30
|
-
submitBtn.disabled = true;
|
|
31
|
-
submitBtn.textContent = 'Loading...';
|
|
32
|
-
|
|
33
|
-
// Reset button after a delay if form doesn't handle it
|
|
34
|
-
setTimeout(() => {
|
|
35
|
-
if (submitBtn.disabled) {
|
|
36
|
-
submitBtn.disabled = false;
|
|
37
|
-
submitBtn.textContent = originalText;
|
|
38
|
-
}
|
|
39
|
-
}, 5000);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Add click handlers for refresh buttons
|
|
45
|
-
const refreshButtons = document.querySelectorAll('[data-refresh]');
|
|
46
|
-
refreshButtons.forEach(button => {
|
|
47
|
-
button.addEventListener('click', () => {
|
|
48
|
-
window.location.reload();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Initialize users API demo if present
|
|
53
|
-
if (typeof fetchUsers === 'function') {
|
|
54
|
-
fetchUsers();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
console.log('✅ Client-side hydration complete');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Global error handler
|
|
61
|
-
window.addEventListener('error', (e) => {
|
|
62
|
-
console.error('🚨 Client error:', e.error);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// Handle API requests with better error handling
|
|
66
|
-
window.apiRequest = async (url, options = {}) => {
|
|
67
|
-
try {
|
|
68
|
-
const token = localStorage.getItem('token');
|
|
69
|
-
const headers = {
|
|
70
|
-
'Content-Type': 'application/json',
|
|
71
|
-
...options.headers
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
if (token) {
|
|
75
|
-
headers.Authorization = `Bearer ${token}`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const response = await fetch(url, {
|
|
79
|
-
...options,
|
|
80
|
-
headers
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (!response.ok) {
|
|
84
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return await response.json();
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error('API request failed:', error);
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// Global fetchUsers function for the demo
|
|
95
|
-
window.fetchUsers = async function() {
|
|
96
|
-
const container = document.getElementById('users-grid');
|
|
97
|
-
if (!container) return;
|
|
98
|
-
|
|
99
|
-
container.innerHTML = '<div class="loading">Loading users...</div>';
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const response = await fetch('/api/users');
|
|
103
|
-
if (!response.ok) {
|
|
104
|
-
throw new Error('Failed to fetch users');
|
|
105
|
-
}
|
|
106
|
-
const data = await response.json();
|
|
107
|
-
const users = data.data.users || [];
|
|
108
|
-
|
|
109
|
-
if (users.length > 0) {
|
|
110
|
-
container.innerHTML = users.map(user => `
|
|
111
|
-
<div class="user-card">
|
|
112
|
-
<h5>${user.name}</h5>
|
|
113
|
-
<p>${user.email}</p>
|
|
114
|
-
<span class="role ${user.role}">${user.role}</span>
|
|
115
|
-
</div>
|
|
116
|
-
`).join('');
|
|
117
|
-
} else {
|
|
118
|
-
container.innerHTML = '<div class="no-users">No users found</div>';
|
|
119
|
-
}
|
|
120
|
-
} catch (error) {
|
|
121
|
-
container.innerHTML = `<div class="error-message">❌ Error: ${error.message}</div>`;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// Auto-generated hydration script
|
|
126
|
-
import { hydrate } from 'frontend-hamroun';
|
|
127
|
-
|
|
128
|
-
// Find SSR content and hydrate it
|
|
129
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
130
|
-
const ssrRoots = document.querySelectorAll('[data-ssr-root]');
|
|
131
|
-
ssrRoots.forEach(root => {
|
|
132
|
-
const componentPath = root.getAttribute('data-component');
|
|
133
|
-
if (componentPath) {
|
|
134
|
-
import(componentPath).then(module => {
|
|
135
|
-
hydrate(module.default, root);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
* {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
body {
|
|
8
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
9
|
-
line-height: 1.6;
|
|
10
|
-
color: #333;
|
|
11
|
-
background: #f8f9fa;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.container {
|
|
15
|
-
max-width: 1200px;
|
|
16
|
-
margin: 0 auto;
|
|
17
|
-
padding: 0 20px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/* Header */
|
|
21
|
-
.header {
|
|
22
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
23
|
-
color: white;
|
|
24
|
-
padding: 1rem 0;
|
|
25
|
-
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.header .container {
|
|
29
|
-
display: flex;
|
|
30
|
-
justify-content: space-between;
|
|
31
|
-
align-items: center;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.header h1 {
|
|
35
|
-
font-size: 1.8rem;
|
|
36
|
-
font-weight: 700;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.header nav {
|
|
40
|
-
display: flex;
|
|
41
|
-
gap: 2rem;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.header nav a {
|
|
45
|
-
color: white;
|
|
46
|
-
text-decoration: none;
|
|
47
|
-
font-weight: 500;
|
|
48
|
-
transition: opacity 0.3s ease;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.header nav a:hover,
|
|
52
|
-
.header nav a.active {
|
|
53
|
-
opacity: 0.8;
|
|
54
|
-
text-decoration: underline;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* Main Content */
|
|
58
|
-
.main-content {
|
|
59
|
-
min-height: calc(100vh - 200px);
|
|
60
|
-
padding: 3rem 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* Hero Section */
|
|
64
|
-
.hero {
|
|
65
|
-
text-align: center;
|
|
66
|
-
margin-bottom: 4rem;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.hero h2 {
|
|
70
|
-
font-size: 2.5rem;
|
|
71
|
-
color: #667eea;
|
|
72
|
-
margin-bottom: 1rem;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.hero p {
|
|
76
|
-
font-size: 1.2rem;
|
|
77
|
-
color: #666;
|
|
78
|
-
margin-bottom: 3rem;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.features {
|
|
82
|
-
display: grid;
|
|
83
|
-
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
84
|
-
gap: 2rem;
|
|
85
|
-
margin-top: 3rem;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.feature {
|
|
89
|
-
background: white;
|
|
90
|
-
padding: 2rem;
|
|
91
|
-
border-radius: 10px;
|
|
92
|
-
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
|
93
|
-
text-align: center;
|
|
94
|
-
transition: transform 0.3s ease;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.feature:hover {
|
|
98
|
-
transform: translateY(-5px);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.feature h3 {
|
|
102
|
-
color: #667eea;
|
|
103
|
-
margin-bottom: 1rem;
|
|
104
|
-
font-size: 1.3rem;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/* API Demo Section */
|
|
108
|
-
.api-demo {
|
|
109
|
-
background: white;
|
|
110
|
-
padding: 3rem;
|
|
111
|
-
border-radius: 15px;
|
|
112
|
-
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
113
|
-
margin-bottom: 3rem;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.api-demo h3 {
|
|
117
|
-
color: #667eea;
|
|
118
|
-
margin-bottom: 2rem;
|
|
119
|
-
font-size: 1.8rem;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.section-header {
|
|
123
|
-
display: flex;
|
|
124
|
-
justify-content: space-between;
|
|
125
|
-
align-items: center;
|
|
126
|
-
margin-bottom: 2rem;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.section-header h4 {
|
|
130
|
-
color: #333;
|
|
131
|
-
font-size: 1.3rem;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/* Users Grid */
|
|
135
|
-
.users-grid {
|
|
136
|
-
display: grid;
|
|
137
|
-
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
138
|
-
gap: 1.5rem;
|
|
139
|
-
margin-bottom: 3rem;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.user-card {
|
|
143
|
-
background: #f8f9fa;
|
|
144
|
-
padding: 1.5rem;
|
|
145
|
-
border-radius: 8px;
|
|
146
|
-
border: 1px solid #e9ecef;
|
|
147
|
-
text-align: center;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.user-card h5 {
|
|
151
|
-
color: #333;
|
|
152
|
-
margin-bottom: 0.5rem;
|
|
153
|
-
font-size: 1.1rem;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.user-card p {
|
|
157
|
-
color: #666;
|
|
158
|
-
margin-bottom: 1rem;
|
|
159
|
-
font-size: 0.9rem;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.role {
|
|
163
|
-
padding: 0.3rem 0.8rem;
|
|
164
|
-
border-radius: 20px;
|
|
165
|
-
font-size: 0.8rem;
|
|
166
|
-
font-weight: 600;
|
|
167
|
-
text-transform: capitalize;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.role.admin {
|
|
171
|
-
background: #e3f2fd;
|
|
172
|
-
color: #1976d2;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.role.user {
|
|
176
|
-
background: #f3e5f5;
|
|
177
|
-
color: #7b1fa2;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/* API Endpoints */
|
|
181
|
-
.endpoints-list {
|
|
182
|
-
display: flex;
|
|
183
|
-
flex-direction: column;
|
|
184
|
-
gap: 1rem;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.endpoint {
|
|
188
|
-
display: flex;
|
|
189
|
-
align-items: center;
|
|
190
|
-
gap: 1rem;
|
|
191
|
-
padding: 1rem;
|
|
192
|
-
background: #f8f9fa;
|
|
193
|
-
border-radius: 6px;
|
|
194
|
-
border-left: 4px solid #667eea;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.method {
|
|
198
|
-
padding: 0.3rem 0.8rem;
|
|
199
|
-
border-radius: 4px;
|
|
200
|
-
font-weight: bold;
|
|
201
|
-
font-size: 0.8rem;
|
|
202
|
-
min-width: 60px;
|
|
203
|
-
text-align: center;
|
|
204
|
-
color: white;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.method.get { background: #28a745; }
|
|
208
|
-
.method.post { background: #007bff; }
|
|
209
|
-
.method.put { background: #ffc107; color: #333; }
|
|
210
|
-
.method.delete { background: #dc3545; }
|
|
211
|
-
|
|
212
|
-
.path {
|
|
213
|
-
font-family: 'Courier New', monospace;
|
|
214
|
-
font-weight: 600;
|
|
215
|
-
color: #667eea;
|
|
216
|
-
min-width: 150px;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.desc {
|
|
220
|
-
color: #666;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/* Getting Started Section */
|
|
224
|
-
.getting-started {
|
|
225
|
-
background: white;
|
|
226
|
-
padding: 3rem;
|
|
227
|
-
border-radius: 15px;
|
|
228
|
-
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.getting-started h3 {
|
|
232
|
-
color: #667eea;
|
|
233
|
-
margin-bottom: 2rem;
|
|
234
|
-
font-size: 1.8rem;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.steps {
|
|
238
|
-
display: grid;
|
|
239
|
-
gap: 2rem;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.step {
|
|
243
|
-
padding: 2rem;
|
|
244
|
-
border: 1px solid #e9ecef;
|
|
245
|
-
border-radius: 8px;
|
|
246
|
-
background: #f8f9fa;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.step h4 {
|
|
250
|
-
color: #333;
|
|
251
|
-
margin-bottom: 1rem;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.step pre {
|
|
255
|
-
background: #2d3748;
|
|
256
|
-
color: #e2e8f0;
|
|
257
|
-
padding: 1rem;
|
|
258
|
-
border-radius: 6px;
|
|
259
|
-
overflow-x: auto;
|
|
260
|
-
margin-top: 1rem;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.step code {
|
|
264
|
-
font-family: 'Courier New', monospace;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* Buttons */
|
|
268
|
-
.btn {
|
|
269
|
-
padding: 0.8rem 1.5rem;
|
|
270
|
-
border: none;
|
|
271
|
-
border-radius: 6px;
|
|
272
|
-
font-size: 1rem;
|
|
273
|
-
font-weight: 600;
|
|
274
|
-
cursor: pointer;
|
|
275
|
-
transition: all 0.3s ease;
|
|
276
|
-
text-decoration: none;
|
|
277
|
-
display: inline-block;
|
|
278
|
-
text-align: center;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.btn-primary {
|
|
282
|
-
background: #667eea;
|
|
283
|
-
color: white;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.btn-primary:hover:not(:disabled) {
|
|
287
|
-
background: #5a6fd8;
|
|
288
|
-
transform: translateY(-2px);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.btn-full {
|
|
292
|
-
width: 100%;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.btn:disabled {
|
|
296
|
-
opacity: 0.6;
|
|
297
|
-
cursor: not-allowed;
|
|
298
|
-
transform: none;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/* Messages */
|
|
302
|
-
.error-message {
|
|
303
|
-
background: #f8d7da;
|
|
304
|
-
color: #721c24;
|
|
305
|
-
padding: 1rem;
|
|
306
|
-
border-radius: 6px;
|
|
307
|
-
margin-bottom: 1.5rem;
|
|
308
|
-
border: 1px solid #f5c6cb;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.success-message {
|
|
312
|
-
background: #d4edda;
|
|
313
|
-
color: #155724;
|
|
314
|
-
padding: 1rem;
|
|
315
|
-
border-radius: 6px;
|
|
316
|
-
margin-bottom: 1.5rem;
|
|
317
|
-
border: 1px solid #c3e6cb;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/* Login Page */
|
|
321
|
-
.login-container {
|
|
322
|
-
display: flex;
|
|
323
|
-
justify-content: center;
|
|
324
|
-
align-items: center;
|
|
325
|
-
min-height: 60vh;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.login-card {
|
|
329
|
-
background: white;
|
|
330
|
-
padding: 3rem;
|
|
331
|
-
border-radius: 15px;
|
|
332
|
-
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
333
|
-
width: 100%;
|
|
334
|
-
max-width: 400px;
|
|
335
|
-
text-align: center;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.login-card h2 {
|
|
339
|
-
color: #667eea;
|
|
340
|
-
margin-bottom: 1rem;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
.login-form {
|
|
344
|
-
margin: 2rem 0;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.form-group {
|
|
348
|
-
margin-bottom: 1.5rem;
|
|
349
|
-
text-align: left;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.form-group label {
|
|
353
|
-
display: block;
|
|
354
|
-
margin-bottom: 0.5rem;
|
|
355
|
-
font-weight: 600;
|
|
356
|
-
color: #333;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
.form-group input {
|
|
360
|
-
width: 100%;
|
|
361
|
-
padding: 0.8rem;
|
|
362
|
-
border: 1px solid #ddd;
|
|
363
|
-
border-radius: 6px;
|
|
364
|
-
font-size: 1rem;
|
|
365
|
-
transition: border-color 0.3s ease;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.form-group input:focus {
|
|
369
|
-
outline: none;
|
|
370
|
-
border-color: #667eea;
|
|
371
|
-
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
.demo-credentials {
|
|
375
|
-
background: #f8f9fa;
|
|
376
|
-
padding: 1.5rem;
|
|
377
|
-
border-radius: 8px;
|
|
378
|
-
margin-top: 2rem;
|
|
379
|
-
text-align: left;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
.demo-credentials h4 {
|
|
383
|
-
color: #667eea;
|
|
384
|
-
margin-bottom: 1rem;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
.demo-credentials p {
|
|
388
|
-
margin-bottom: 0.5rem;
|
|
389
|
-
font-size: 0.9rem;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/* Footer */
|
|
393
|
-
.footer {
|
|
394
|
-
background: #2d3748;
|
|
395
|
-
color: white;
|
|
396
|
-
padding: 2rem 0;
|
|
397
|
-
text-align: center;
|
|
398
|
-
margin-top: 4rem;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/* Responsive Design */
|
|
402
|
-
@media (max-width: 768px) {
|
|
403
|
-
.header .container {
|
|
404
|
-
flex-direction: column;
|
|
405
|
-
gap: 1rem;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.header nav {
|
|
409
|
-
gap: 1rem;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.hero h2 {
|
|
413
|
-
font-size: 2rem;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.features {
|
|
417
|
-
grid-template-columns: 1fr;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.section-header {
|
|
421
|
-
flex-direction: column;
|
|
422
|
-
gap: 1rem;
|
|
423
|
-
align-items: stretch;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
.users-grid {
|
|
427
|
-
grid-template-columns: 1fr;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.endpoint {
|
|
431
|
-
flex-direction: column;
|
|
432
|
-
align-items: flex-start;
|
|
433
|
-
gap: 0.5rem;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
.api-demo,
|
|
437
|
-
.getting-started {
|
|
438
|
-
padding: 2rem;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.login-card {
|
|
442
|
-
padding: 2rem;
|
|
443
|
-
margin: 1rem;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Temporary workaround - import from relative path during development
|
|
2
|
-
import { createServer } from '../../dist/server/index.js';
|
|
3
|
-
|
|
4
|
-
const server = createServer({
|
|
5
|
-
port: process.env.PORT || 3000,
|
|
6
|
-
apiDir: './src/api',
|
|
7
|
-
pagesDir: './src/pages',
|
|
8
|
-
staticDir: './public',
|
|
9
|
-
enableCors: true,
|
|
10
|
-
// Uncomment to enable database
|
|
11
|
-
// db: {
|
|
12
|
-
// type: 'mongodb', // or 'mysql', 'postgres'
|
|
13
|
-
// url: process.env.DATABASE_URL || 'mongodb://localhost:27017/baraqex'
|
|
14
|
-
// },
|
|
15
|
-
// Uncomment to enable authentication
|
|
16
|
-
// auth: {
|
|
17
|
-
// secret: process.env.JWT_SECRET || 'your-secret-key',
|
|
18
|
-
// expiresIn: '7d'
|
|
19
|
-
// }
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
server.enableSSR({ hydratable: true });
|
|
23
|
-
|
|
24
|
-
server.start().then(() => {
|
|
25
|
-
console.log('🚀 Baraqex Full-Stack server started successfully!');
|
|
26
|
-
console.log('📱 Frontend: http://localhost:3000');
|
|
27
|
-
console.log('🔌 API: http://localhost:3000/api');
|
|
28
|
-
console.log('📚 API Docs: http://localhost:3000/api-docs');
|
|
29
|
-
}).catch(error => {
|
|
30
|
-
console.error('❌ Failed to start server:', error);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// POST /api/auth/login - User login
|
|
2
|
-
export async function post(req, res) {
|
|
3
|
-
try {
|
|
4
|
-
const { email, password } = req.body;
|
|
5
|
-
|
|
6
|
-
// Validate input
|
|
7
|
-
if (!email || !password) {
|
|
8
|
-
return res.status(400).json({
|
|
9
|
-
success: false,
|
|
10
|
-
message: 'Email and password are required'
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Mock authentication - replace with actual user verification
|
|
15
|
-
const mockUser = {
|
|
16
|
-
id: 1,
|
|
17
|
-
name: 'John Doe',
|
|
18
|
-
email: 'john@example.com',
|
|
19
|
-
role: 'admin'
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// In a real app, verify password against database
|
|
23
|
-
if (email === 'john@example.com' && password === 'password123') {
|
|
24
|
-
// Generate token (you'll need to implement JWT logic)
|
|
25
|
-
const token = 'mock-jwt-token-' + Date.now();
|
|
26
|
-
|
|
27
|
-
res.json({
|
|
28
|
-
success: true,
|
|
29
|
-
message: 'Login successful',
|
|
30
|
-
data: {
|
|
31
|
-
user: mockUser,
|
|
32
|
-
token
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
res.status(401).json({
|
|
37
|
-
success: false,
|
|
38
|
-
message: 'Invalid credentials'
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
} catch (error) {
|
|
42
|
-
res.status(500).json({
|
|
43
|
-
success: false,
|
|
44
|
-
message: 'Login failed',
|
|
45
|
-
error: error.message
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|