Skip to content

anshulrgoyal/freecharge-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo App for sharing files

The app create a file in File System and save a document in database for managing ownership.

APIs

  1. (POST) /api/user/signin for getting a token. It takes email and password and return JWT token.
  • Request:
{
  "email": "anshul@example.com",
  "password": "password12345"
}
  • Response:
{
  "token": "<jsontoken>"
}
  1. (POST) /api/user/register for creating a user. It takes email, name and password. It return JWT token.
  • Request
{
  "name": "anshul",
  "email": "anshul@example.com",
  "password": "password12345"
}
  • Response:
{
  "token": "<jsontoken>"
}
  1. (GET) /api/file for get all the file form database.
  • Response:
[
  {
    "_id": "5fa3075431087ddf20352705",
    "name": "Adobe Scan Nov 04, 2020.pdf",
    "mimetype": "application/pdf",
    "__v": 0
  }
]
  1. (Get) /api/file/:id for getting file.
  • Response:
  1. (Delete) /api/file/:id for deleting a file from Fs and database
  • Request:

    • Header : Authorization: Bearer <token>
  • Response:

{
  "message": "success"
}
  1. (Post) /api/file/ for creating a file in fs and database
  • Request:

    • Header : Authorization: Bearer <token>
  • Response:

{
  "_id": "5fa308a731087ddf20352706",
  "path": "/home/agoyal/app/backend/uploads/mozilla.pdf-1604520103565",
  "name": "mozilla.pdf",
  "owner": "5fa2b0a03ea4dd68fb99385d",
  "mimetype": "application/pdf",
  "__v": 0
}

Hosted

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published