vibe-gx 3.0.0 → 3.2.0
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/README.md +37 -1
- package/package.json +1 -1
- package/vibe.js +3 -0
package/README.md
CHANGED
|
@@ -269,7 +269,7 @@ app.post(
|
|
|
269
269
|
{
|
|
270
270
|
media: {
|
|
271
271
|
dest: "uploads", // Subfolder destination
|
|
272
|
-
public: true, // Save
|
|
272
|
+
public: true, // Save in public folder (default: true)
|
|
273
273
|
maxSize: 5 * 1024 * 1024, // Max file size: 5MB
|
|
274
274
|
allowedTypes: ["image/jpeg", "image/png", "image/*"], // Wildcards supported
|
|
275
275
|
},
|
|
@@ -278,6 +278,42 @@ app.post(
|
|
|
278
278
|
);
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
+
### Public vs Private Uploads
|
|
282
|
+
|
|
283
|
+
**Public uploads** (web-accessible):
|
|
284
|
+
|
|
285
|
+
```javascript
|
|
286
|
+
app.post(
|
|
287
|
+
"/upload/avatar",
|
|
288
|
+
{
|
|
289
|
+
media: {
|
|
290
|
+
public: true, // ✅ Files accessible via HTTP
|
|
291
|
+
dest: "avatars", // Saved to: public/avatars/
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
handler,
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
// Files accessible at: http://yourapp.com/avatars/filename.jpg
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Private uploads** (server-only access):
|
|
301
|
+
|
|
302
|
+
```javascript
|
|
303
|
+
app.post(
|
|
304
|
+
"/upload/documents",
|
|
305
|
+
{
|
|
306
|
+
media: {
|
|
307
|
+
public: false, // 🔒 Files NOT web-accessible
|
|
308
|
+
dest: "documents", // Saved to: private/documents/
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
handler,
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
// Files only accessible via your backend code (e.g., sendAbsoluteFile)
|
|
315
|
+
```
|
|
316
|
+
|
|
281
317
|
### Uploaded File Object
|
|
282
318
|
|
|
283
319
|
```javascript
|
package/package.json
CHANGED
package/vibe.js
CHANGED
|
@@ -474,6 +474,7 @@ const vibe = () => {
|
|
|
474
474
|
const route = {
|
|
475
475
|
method: "GET",
|
|
476
476
|
path: routePath,
|
|
477
|
+
pathRegex: pathToRegex(routePath),
|
|
477
478
|
handler: (req, res) => {
|
|
478
479
|
try {
|
|
479
480
|
const filePath = req.url
|
|
@@ -491,6 +492,8 @@ const vibe = () => {
|
|
|
491
492
|
media: { public: true, dest: null },
|
|
492
493
|
};
|
|
493
494
|
trie.insert("GET", routePath, route);
|
|
495
|
+
routes.push(route);
|
|
496
|
+
options.routeCount++;
|
|
494
497
|
}
|
|
495
498
|
|
|
496
499
|
/**
|