Skip to content

amitpoitrix/secure-file-upload

Repository files navigation

secure-file-upload

Description

Secure File Upload & Metadata Processing Microservice

Installation

$ npm install

Running the app

# 1. populate User DB - to get the JWT Token
$ npm run start:seed

# 2. check data in DB
$ npm run start:db

# 3. run redis locally (for background job process)
$ brew install redis # install it if not yet installed
$ brew services start redis

# 3. running server locally
$ npm run start

CURL Commands for Different Endpoints

  1. Health Endpoint
curl --location 'http://localhost:3000/v1/health'
  1. Login Endpoint - To generate JWT Token
curl --location 'http://localhost:3000/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "[email protected]",
    "password": "password"
}'
  1. Upload Endpoint
curl --location 'http://localhost:3000/upload' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImlhdCI6MTc0NzY1MzExOSwiZXhwIjoxNzQ3NjU2NzE5fQ.XeLdWUTdjOWsFAAskyvQzq19xOFWPAByGmrJrpxOo4' \
--form 'file=@"/Users/mac/nestjs/secure-file-upload/sample/testFile.txt"' \
--form 'title="My Sample File"' \
--form 'description="Just a test file upload"'
  1. Get File Endpoint
curl --location 'http://localhost:3000/files/2' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImlhdCI6MTc0NzY1MzExOSwiZXhwIjoxNzQ3NjU2NzE5fQ.XeLdWUTdjOWsFAAskyvQzq19xOTWPAByGmrJrpxOo4'

About

Secure File Upload & Metadata Processing Microservice using NestJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors