express-project-builder 1.0.13 → 1.0.14

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.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -345,3 +345,35 @@ import notFound from "./app/middlewares/notFound";
345
345
  app.use(globalErrorHandler as unknown as express.ErrorRequestHandler);
346
346
  app.use(notFound as unknown as express.ErrorRequestHandler);
347
347
  ```
348
+
349
+ - /src/middlewares/**handleFileUpload.ts**
350
+ Middleware for handling file uploads in multipart/form-data requests. Uses `multer` to process uploaded files and stores them in the specified directory. Returns an array of file objects (`req.files`) to the next middleware.
351
+
352
+ ```typescript
353
+ // In your route file
354
+ import { handle_file_upload_middleware } from "../../middlewares/handleFileUpload";
355
+
356
+ // Apply the middleware to the route
357
+ router.post(
358
+ "/create",
359
+ handle_file_upload_middleware([
360
+ {
361
+ fieldName: "image", // Form field name for the file
362
+ maxCount: 1, // Maximum number of files allowed
363
+ fileType: "image", // Type of file (image, document, etc.)
364
+ optional: false, // Whether the file is required,
365
+ allowedImageTypes: [
366
+ "image/jpeg",
367
+ "image/png",
368
+ "image/gif",
369
+ "image/webp",
370
+ "image/bmp",
371
+ "image/svg+xml",
372
+ ], // Allowed image types,
373
+ maxImageSize: 1024 * 1024 * 2, // Maximum image size in bytes (2MB)
374
+ },
375
+ ]),
376
+ formDataToSetJSONformatData, // Convert form data to JSON
377
+ ProductController.createProduct
378
+ );
379
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-project-builder",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "A powerful and professional Express.js project generator CLI that instantly scaffolds a production-ready backend with TypeScript, modular architecture, and built-in support for MongoDB (Mongoose) or PostgreSQL (Prisma). Includes authentication, error handling, rate limiting, file upload, caching, and utility functions—so you can focus on building features instead of boilerplate. Perfect for kickstarting your next Express.js API project with best practices and modern tools.",
5
5
  "type": "module",
6
6
  "main": "dist/bin/index.js",