This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import { CldUploadWidget } from 'next-cloudinary'; | |
const cloudinary = () => { | |
const [imagen, setImagen] = useState('') | |
//opciones de cloudinary widget | |
const cloudinaryOptions = { | |
sources: ['local'], | |
multiple: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { v2 as cloudinary } from 'cloudinary'; | |
//para firmar la imagen | |
export default async function signCloudinary(req, res) { | |
const body = JSON.parse(req.body) || {}; | |
const { paramsToSign } = body; | |
try { | |
const signature = cloudinary.utils.api_sign_request( | |
paramsToSign, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//controlador | |
import signCloudinary from '../sign-cloudinary'; | |
export default function handler(req, res) { | |
//type of request | |
const { method } = req; | |
switch (method) { | |
case 'GET': | |
res.status(200).json({ msg: 'GET Request' }); |