Node.js: Download file from server
This is a Rest API which downloads a given file (if exists) from a given directory (configured in .env).
GET /
GET /filedownload/${filename}
Parameter | Type | Description |
---|---|---|
filename |
string |
Required. file name to download |
To run this project, you will need to add the following environment variables to your .env file
DOWNLOAD_DIRECTORY
Clone the project
git clone https://github.com/TheRavi/download-file-from-server
Go to the project directory
cd download-file-from-server
Install dependencies
npm install
Start the server
npm start
To run tests, run the following command
npm run test
To open Cypress and run tests, run the following command
npm run cypress:open
To see coverage report, run the following command
npx nyc report