juxscript 1.1.258 → 1.1.260
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/machinery/serve.js +18 -16
- package/package.json +1 -1
package/machinery/serve.js
CHANGED
|
@@ -116,6 +116,24 @@ app.get('/__jux_sources.json', (req, res) => {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
+
// ═══════════════════════════════════════════════════════════════
|
|
120
|
+
// API ROUTES — must come BEFORE static middleware and catch-all
|
|
121
|
+
// ═══════════════════════════════════════════════════════════════
|
|
122
|
+
app.get('/api/test', (req, res) => {
|
|
123
|
+
res.json({
|
|
124
|
+
users: [
|
|
125
|
+
{ id: 1, name: 'Alice', email: 'alice@example.com' },
|
|
126
|
+
{ id: 2, name: 'Bob', email: 'bob@example.com' },
|
|
127
|
+
{ id: 3, name: 'Charlie', email: 'charlie@example.com' }
|
|
128
|
+
],
|
|
129
|
+
posts: [
|
|
130
|
+
{ id: 1, title: 'Hello World', userId: 1 },
|
|
131
|
+
{ id: 2, title: 'Testing JUX', userId: 2 }
|
|
132
|
+
],
|
|
133
|
+
timestamp: new Date().toISOString()
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
119
137
|
const hotReloadScript = `
|
|
120
138
|
<script>
|
|
121
139
|
(function() {
|
|
@@ -226,22 +244,6 @@ if (HOT_RELOAD) {
|
|
|
226
244
|
});
|
|
227
245
|
};
|
|
228
246
|
|
|
229
|
-
// Fake data API endpoint for testing
|
|
230
|
-
app.get('/api/test', (req, res) => {
|
|
231
|
-
res.json({
|
|
232
|
-
users: [
|
|
233
|
-
{ id: 1, name: 'Alice', email: 'alice@example.com' },
|
|
234
|
-
{ id: 2, name: 'Bob', email: 'bob@example.com' },
|
|
235
|
-
{ id: 3, name: 'Charlie', email: 'charlie@example.com' }
|
|
236
|
-
],
|
|
237
|
-
posts: [
|
|
238
|
-
{ id: 1, title: 'Hello World', userId: 1 },
|
|
239
|
-
{ id: 2, title: 'Testing JUX', userId: 2 }
|
|
240
|
-
],
|
|
241
|
-
timestamp: new Date().toISOString()
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
|
|
245
247
|
const compiler = new JuxCompiler({
|
|
246
248
|
srcDir: SRC_DIR,
|
|
247
249
|
distDir: DIST_DIR,
|