https://github.com/ujjawal-1999/gridfs-image-upload
Image Upload and saving to database using multer-gridfs-storage and displaying using gridfs-stream
https://github.com/ujjawal-1999/gridfs-image-upload
Last synced: 3 months ago
JSON representation
Image Upload and saving to database using multer-gridfs-storage and displaying using gridfs-stream
- Host: GitHub
- URL: https://github.com/ujjawal-1999/gridfs-image-upload
- Owner: ujjawal-1999
- Created: 2020-06-06T21:20:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T00:16:56.000Z (over 2 years ago)
- Last Synced: 2025-01-22T14:15:03.322Z (4 months ago)
- Language: JavaScript
- Size: 224 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Image Upload Using Multer and GridFS
The repo contains an api/app to upload, store and view images using multer,
multer-gridfs-storage and gridfs-stream.
The file names are generated using the crypto module available with Nodejs.
Method-Override package is used to override the POST request to DELETE request
while deleting a particular file.
Only images are rendered.### Tech Stack
- Express
- Multer
- Crypto
- Multer-Gridfs-Storage
- Gridfs-Stream
- Method-override`npm install`
Change the MONGODB_URI with your Connection string
## Running the app
`npm start` Or `npm run dev`### Routes
1. GET `/` to get the form and all the uploaded images being displayed
2. POST `/upload` to post the image and save it to the database as well as render on the main page
3. GET `/files` to view all the file data in json format
4. GET `/files/:filename` to get details about a particular file in json format
5. GET `/image/:filename` to view the image separately in the browser.
6. DELETE `/files/:id` to delete a particular image from the page as well as the database.