Skip to content

A simple crud operation based solution for file and folder operations using mongodb and express

Notifications You must be signed in to change notification settings

SaikumarRagala/FileFolderOperations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Folder and File Crud operations Application

Build a Restful CRUD API for a file and directory operations without actually creating them using Node.js, Express and MongoDB.

Steps to Setup

  1. clone the git repo , go to project folder and run the below command to install all dependencies
npm install --save
  1. Update the database endpoint in config/database.config.js file with your mongodb connection string

  2. Run Server

node server.js

You can use postman to test the apis at http://localhost:3000

APIs for Folder Operations

  1. create folder
POST - http://localhost:3000/folder
payload : 
{
    "name" : "name of the folder (eg :  "dir1")",
    "path" : "existing directory (eg : "/test")"
}
  1. List all folders
GET - http://localhost:3000/folder/
3) Fetch single folder 
GET - http://localhost:3000/folder/:folderId

4)Update folder name

PUT - http://localhost:3000/folder/:folderId
payload : 
{
    "name" : "name of the folder (eg :  "dir1")",
    "path" : "existing directory (eg : "/test")"
}
  1. Delete the folder
DELETE - http://localhost:3000/folder/:folderId

APIs for File Operations

  1. create file
POST - http://localhost:3000/fileData
payload : 
{
    "name" : "name of the file (eg :  "test.png")",
    "folderId" : "Existing folderId"
}
2) List all files in a folder
GET - http://localhost:3000/fileData/:folderId

3)Update file name

PUT - http://localhost:3000/folder/:fileId
payload : 
{
    "name" : "name of the file"
}
  1. Delete the file
DELETE - http://localhost:3000/folder/:fileId
### For importing the requests directly to postman, import the file "FileFolderOperation.json" in postman 

About

A simple crud operation based solution for file and folder operations using mongodb and express

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published