Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
How to specify library version when using import in js?

I am trying to import cloudinary to my project, and in their documentation it says that I have to use require and specify the version to v2 like this const cloudinary = require("cloudinary").v2;. However, I have specified that my type in package.json as 'module', so I cannot use require I only have to say import. so, my question is how do I specify the version to v2. currently, I can upload to the cloudinary server, but I cannot get back the link to it. here is my cod:

my configuration

import multer from "multer";
import cloudinary from "cloudinary";
import { CloudinaryStorage } from "multer-storage-cloudinary";
import dotenv from "dotenv";

cloudinary.config({
  cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
  api_key: process.env.CLOUDINARY_KEY,
  api_secret: process.env.CLOUDINARY_SECRET,
});
const storage = new CloudinaryStorage({
  cloudinary: cloudinary,
  params: {
    folder: "ecommerce",
  },
});
const upload = multer({ storage: storage });

my route

productsRoutes.post("/products", upload.single("image"), async (req, res) => {
  console.log(req.file);
});

currently, the console log prints nothing when I submit the image, but it does upload it to the server.

sorry if my question is badly formatted, and any help is greatly appreciate it.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!