Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda