DEV Community

Adeeyo adewale temitayo
Adeeyo adewale temitayo

Posted on

Upload Multiple images to cloudinary Node, MongoDB, Express

Hello there
In this post we are going to create a backend Node JS server that uses the cloudinary library to upload multiple images at once because cloudinary doesn't support multiple images by default so we are going to find a way around it. Brace yourselves, I hope you are excited as I am.

Requirements

We will need the following installed on our machines to get started;

Let get started.

First, we create our project folder and also initialize our project using the following.

mkdir cloud_mutilple_image
cd cloud_mutilple_image
npm inti

which would create a package.json file for us.

PROJECT STRUCTURE

Next, we would structure our project, in the root folder we would need to create a server.js file, which would be the main entry point of our application, then we will need a helper folder to contain our application helper.js file. Our project structure would look like this.

Screen Shot 2019-11-08 at 6.06.33 PM.png

package.json:

Screen Shot 2019-11-08 at 7.09.29 PM.png

Server.js file Where we will be starting our development server

Screen Shot 2019-11-08 at 6.14.15 PM.png

helper.js file where will have our upload (helper) function

Screen Shot 2019-11-08 at 6.41.40 PM.png

Now let create a user folder where we will have Our user.controller.js, user.model.js and user.route.js

user.model.js

Screen Shot 2019-11-08 at 6.50.07 PM.png

user.controller.js

Screen Shot 2019-11-08 at 6.46.00 PM.png

Screen Shot 2019-11-08 at 6.46.25 PM.png

find all created user:

Screen Shot 2019-11-08 at 6.49.00 PM.png

user.route.js

Screen Shot 2019-11-08 at 6.51.55 PM.png

Now let test our endpoints:

create endpoint:

Screen Shot 2019-11-08 at 6.54.30 PM.png
find endpoint:

Screen Shot 2019-11-08 at 6.55.34 PM.png

Click Here to Get source code

Top comments (4)

Collapse
 
juandelgado06 profile image
Juan Delgado

Very very thanks bro, I love you work

Collapse
 
dev_tycodez profile image
Adeeyo adewale temitayo

Thanks

Collapse
 
thegodtune profile image
Lt. Aujio Yaanji πŸ‡³πŸ‡¬

Thank you man, you saved my head.

Collapse
 
dev_tycodez profile image
Adeeyo adewale temitayo • Edited

I'm so happy to hear this