feat: integrate MinIO for video storage, add video routes, and update README with API documentation
This commit is contained in:
@@ -21,6 +21,14 @@ DATABASE_URL=postgres://username:password@localhost:5432/database_name
|
||||
JWT_SECRET=replace_with_a_long_random_secret
|
||||
JWT_EXPIRES_IN=7d
|
||||
PORT=3000
|
||||
MINIO_ENDPOINT=localhost
|
||||
MINIO_PORT=9000
|
||||
MINIO_USE_SSL=false
|
||||
MINIO_ACCESS_KEY=minioadmin
|
||||
MINIO_SECRET_KEY=minioadmin
|
||||
MINIO_BUCKET=videos
|
||||
MINIO_REGION=us-east-1
|
||||
MINIO_PRESIGNED_EXPIRY_SECONDS=600
|
||||
```
|
||||
|
||||
## Run app
|
||||
@@ -78,3 +86,41 @@ Get current user:
|
||||
GET /auth/me
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
## Video API (Dummy MinIO S3 Integration)
|
||||
|
||||
All routes require a JWT Bearer token.
|
||||
|
||||
Create a presigned upload URL:
|
||||
|
||||
```bash
|
||||
POST /videos/upload-url
|
||||
Authorization: Bearer <token>
|
||||
{
|
||||
"fileName": "sample.mp4",
|
||||
"prefix": "raw"
|
||||
}
|
||||
```
|
||||
|
||||
Get a presigned download URL:
|
||||
|
||||
```bash
|
||||
GET /videos/download-url?objectKey=raw/<user-id>/<timestamp>-sample.mp4
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
List video objects:
|
||||
|
||||
```bash
|
||||
GET /videos?prefix=raw&limit=20
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
Delete a video object:
|
||||
|
||||
```bash
|
||||
DELETE /videos?objectKey=raw/<user-id>/<timestamp>-sample.mp4
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**Self-hosted MinIO note** Make sure the backend can reach your MinIO endpoint (network, TLS, credentials) and mirror any bucket changes you make outside of the app in `MINIO_BUCKET`, otherwise uploads/downloads fail.
|
||||
|
||||
Reference in New Issue
Block a user