๐ File Uploads โ
KitchenAsty handles image uploads for menu items using Multer middleware.
โ๏ธ Configuration โ
Uploads are saved to the uploads/ directory at the server root. Files are served statically at /uploads/.
๐ผ๏ธ Accepted Formats โ
| MIME Type | Extension |
|---|---|
image/jpeg | .jpg, .jpeg |
image/png | .png |
image/webp | .webp |
image/gif | .gif |
๐ Limits โ
| Setting | Value |
|---|---|
| Max file size | 5 MB |
| Storage | Disk (uploads/ directory) |
| Filename | UUID-based to avoid collisions |
๐ค Upload API โ
POST /api/menu/items/:id/image
Content-Type: multipart/form-data
Authorization: Bearer <staff-token>
Form field: imageSee Image Uploads for the full API reference.
๐ณ Docker Volumes โ
In Docker, the uploads directory is inside the container. To persist uploads across container restarts, mount a volume in docker-compose.yml:
yaml
server:
volumes:
- ./uploads:/app/uploads๐ Serving Uploaded Files โ
The Express server serves uploaded files at /uploads/:
typescript
app.use('/uploads', express.static(path.resolve(process.cwd(), 'uploads')));In Docker, the admin and storefront nginx configs proxy /uploads/ to the server container.
๐ญ Production Notes โ
For production deployments, consider:
- ๐พ Mounting a persistent volume for the uploads directory
- โ๏ธ Using a CDN or object storage (S3) for uploaded images
- ๐ Setting appropriate file size limits at the nginx level