multer-express-middleware
TypeScript icon, indicating that this package has built-in type declarations

0.0.3Β β€’Β PublicΒ β€’Β Published

Multer Express Middleware β™»

A weekend project that will help you to easily setup multer with just a middleware. 🌈

GitHub license GitHub issues GitHub stars Twitter Follow

Usage πŸ”₯

Installing the module.

yarn add multer-express-middleware

Using the middleware with Express.

const app = require('express')()
const imageStore = require('multer-express-middleware')

app.use("/api", imageStore({
    // Folder where you would like to save files or images (required)
    destination: "uploads",

    // Property where you would like to set selected image or file while uploading form frontend...
    imageProperty: "image", 

    customize: {
        upload: {
            // field you want to fill while posting an api request... ex "imageFolderName"
            folderProperty: "folder",

            // folder to save image or file
            subFolderProperty: "subfolder" 
            
            // Api path for uploading image or file
            path: "/image/upload" 
        },
        delete: {
            // Property where you would to set image path while giving an post request.
            filePathProperty: "imagePath",

            // API path for deleting image or file
            path: '/image/delete'
        }
    },

    // Custom middlewares, if you wish... ;)
    middlewares: [isSignedIn, isAuthenticated] 
}))

TODO: Need to add some more stuff over here...

Why made this? πŸ€”

Just wanted to make something that I could use in all of my MERN Projects. It's a big pain recreating this everytime I start a new project. πŸ˜…

Author

πŸ‘€ Piyush Suthar

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Package Sidebar

Install

npm i multer-express-middleware

Weekly Downloads

3

Version

0.0.3

License

MIT

Unpacked Size

13.9 kB

Total Files

7

Last publish

Collaborators

  • piyushsuthar