- GET
/api/users/healthcheck
- For Checking the Users endpoints health - POST
/api/users/login
- Login with the registered user and use the JWT token from response for other requests - POST
/api/users/register
- Register the user - GET
/api/files/healthcheck
- For Checking the Files endpoints health - GET
/api/files/
- For listing all uploaded files filtered by logged in user - POST
/api/files/
- For uploading file - DELETE
/api/files/
- For deleting file from the S3 storage and database
To setup the project please follow these guidelines
- Make sure that you have nodejs and npm installed in your system.
- Run command
npm install
in the project root directory to install all the dependencies from thepackage.json
file. - Create a file
.env
in the project root directory and add these environmentsMONGO_URI
,SECRET_OR_KEY
,PORT
,AWS_ACCESS_KEY
,AWS_SECRET_KEY
,S3_BUCKET_NAME
,AWS_REGION
, andUPLOAD_ROOT
. - Place the MongoDB connection string in the
MONGO_URI
. You can refer tohttps://www.mongodb.com/cloud/atlas
which i have used. SECRET_OR_KEY
is the secret key for your password. Make sure this is strong enough to not get cracked easily.PORT
is the port on which you want to run the server. If this is not provided then application will run on default port3000
.AWS_ACCESS_KEY
,AWS_SECRET_KEY
,S3_BUCKET_NAME
, andAWS_REGION
are the credentials required to access AWS services.UPLOAD_ROOT
is the directory where the files will be uploaded.- After setting up the
.env
file runnpm run server
ornpm start
in the root to run the nodemon server or normal server respectively. - Refer to this Postman collection for testing the endpoints
https://www.getpostman.com/collections/d48a66d19fe7a80282e0
Don't forget to Star and Fork the repository.
Have fun!