Skip to content

Latest commit

 

History

History
50 lines (31 loc) · 1.48 KB

file-uploading.md

File metadata and controls

50 lines (31 loc) · 1.48 KB

File uploading


Table of Contents


General info

MulterModule from @nestjs/platform-express is used to upload files. General principles you can read in official documentation.


Drivers support

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.


Uploading and attach file flow

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.

An example of uploading an avatar to a user profile

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
Loading

Video example

file-uploading.mp4

Previous: Serialization