DEV Community

Adeeyo Temitayo
Adeeyo Temitayo

Posted on

3 1 1

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

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (4)

Collapse
 
juandelgado06 profile image
Juan Delgado β€’

Very very thanks bro, I love you work

Collapse
 
dev_tycodez profile image
Adeeyo Temitayo β€’

Thanks

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

Thank you man, you saved my head.

Collapse
 
dev_tycodez profile image
Adeeyo Temitayo β€’ β€’ Edited

I'm so happy to hear this

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series