juxscript 1.1.260 → 1.1.261
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 -0
- package/package.json +1 -1
package/machinery/serve.js
CHANGED
|
@@ -106,6 +106,24 @@ 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
|
+
res.json({
|
|
114
|
+
users: [
|
|
115
|
+
{ id: 1, name: 'Alice', email: 'alice@example.com' },
|
|
116
|
+
{ id: 2, name: 'Bob', email: 'bob@example.com' },
|
|
117
|
+
{ id: 3, name: 'Charlie', email: 'charlie@example.com' }
|
|
118
|
+
],
|
|
119
|
+
posts: [
|
|
120
|
+
{ id: 1, title: 'Hello World', userId: 1 },
|
|
121
|
+
{ id: 2, title: 'Testing JUX', userId: 2 }
|
|
122
|
+
],
|
|
123
|
+
timestamp: new Date().toISOString()
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
109
127
|
app.get('/__jux_sources.json', (req, res) => {
|
|
110
128
|
const snapshotPath = path.join(DIST_DIR, '__jux_sources.json');
|
|
111
129
|
if (fs.existsSync(snapshotPath)) {
|