A file sharing app, using 'EJS templates'
fshare, is a fullstack project, which is help the user to upload any file, and after sharing get the donwload file link or share with specific user who want to download.Also have the features, its automatically delete file after 24 hour. After getting the link ,users can share via Email, whatsapp or use of other chat plateform.But didnot upload file upto 100 MB.
Server: NodeJS, ExpressJS, MongoDB, EJS
Clone the project
git clone https://github/Nik4Furi/fshareGo to the project directory
cd fshareInstall dependencies
npm installStart the server
npm run start (start at only time)
npm run dev (Run or restart, whenever you save any file(js))To run this project, you will need to add the following environment variables to your .env file also can see .env.exmaple file
Server Configurations
PORT = 8000
URL = http://localhost
Database configurations
DB_SERVER
DB_HOST
DB_PORT
DB_NAME
Session key configurations
SECRET_SESSION
| Color | Hex |
|---|---|
| Primary Color | #0d6efd |
GET /| Parameter | Type | Description |
|---|---|---|
| - | get |
See our home page,where we upload files |
POST /upload| Parameter | Type | Description |
|---|---|---|
| - | POST |
file must be required.To upload a file into database |
GET /show/:uuid| Parameter | Type | Description |
|---|---|---|
uuid |
GET |
uuid must be required.Because show the details of given uuid match file |
GET /download/:uuid| Parameter | Type | Description |
|---|---|---|
uuid |
GET |
uuid must be required.Because donwload file only uuid match |
Deleting the file,which are 24 hour delay.
const DeleteDoc24Hour = async(Modal)=>{
const today = new Date(Date.now());
today.setHours(0,0,0,0);
await Modal.deleteMany({createdAt : {$lt:today}});
}
module.exports = DeleteDoc24HourUploading the files ,using this middleware
//---------import the dependies to uploads files
const multer = require('multer');
const path = require('path');
//Define the storage where to save our files
const Storage = multer.diskStorage({
destination : 'uploads',
filename : (req,file,cb)=>{
const uniqueName = `${Date.now()}-${Math.floor(Math.random() * 1E9)}${path.extname(file.originalname)}`;
cb(null,uniqueName);
}
})
//Define the uploads with some limitations
const Upload = multer({
storage : Storage,
limits : {fileSize : 1000 * 1000 * 100}
}).single('myfile')
module.exports = Upload; - Delete any file which is late from 24 hour
- Upload any kind of file, but its not more than 100 MB
- Use Components
- Basec On MVC Architecture
Here are some related projects




