MulterModule
from @nestjs/platform-express
is used to upload files. General principles you can read in official documentation.
Out of box boilerplate support two drivers: local
and s3
. You can set it in .env
file, variable FILE_DRIVER
. If you want use other service for storing files, you can extend it.
Endpoint /api/v1/files/upload
is used for uploading files, which return File
entity with id
and path
. After receiving File
entity you can attach this to another entity.
sequenceDiagram
participant A as Fronted App
participant B as Backend App
A->>B: Upload file via POST /api/v1/files/upload
B->>A: Receive File entity with "id" and "path" properties
note left of A: Attach File entity to User entity
A->>B: Update user via PATCH /api/v1/auth/me
file-uploading.mp4
Previous: Serialization