juxscript 1.1.260 → 1.1.262
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 +22 -0
- package/package.json +1 -1
package/machinery/serve.js
CHANGED
|
@@ -106,6 +106,28 @@ app.use((req, res, next) => {
|
|
|
106
106
|
app.get('/favicon.ico', (req, res) => res.status(204).end());
|
|
107
107
|
app.get('/favicon.png', (req, res) => res.status(204).end());
|
|
108
108
|
|
|
109
|
+
// ═══════════════════════════════════════════════════════════════
|
|
110
|
+
// API ROUTES — BEFORE static and catch-all
|
|
111
|
+
// ═══════════════════════════════════════════════════════════════
|
|
112
|
+
app.get('/api/test', (_req, res) => {
|
|
113
|
+
const fruits = ['apple', 'banana', 'orange', 'mango', 'strawberry', 'grape', 'watermelon', 'pineapple', 'kiwi', 'peach'];
|
|
114
|
+
const randomFruit = fruits[Math.floor(Math.random() * fruits.length)];
|
|
115
|
+
|
|
116
|
+
res.json({
|
|
117
|
+
randomFruit,
|
|
118
|
+
users: [
|
|
119
|
+
{ id: 1, name: 'Alice', email: 'alice@example.com' },
|
|
120
|
+
{ id: 2, name: 'Bob', email: 'bob@example.com' },
|
|
121
|
+
{ id: 3, name: 'Charlie', email: 'charlie@example.com' }
|
|
122
|
+
],
|
|
123
|
+
posts: [
|
|
124
|
+
{ id: 1, title: 'Hello World', userId: 1 },
|
|
125
|
+
{ id: 2, title: 'Testing JUX', userId: 2 }
|
|
126
|
+
],
|
|
127
|
+
timestamp: new Date().toISOString()
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
109
131
|
app.get('/__jux_sources.json', (req, res) => {
|
|
110
132
|
const snapshotPath = path.join(DIST_DIR, '__jux_sources.json');
|
|
111
133
|
if (fs.existsSync(snapshotPath)) {
|