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
/* | |
Considero que es un buen ejemplo ya que tengo una buena separación | |
de responsabilidades en el código, el endpoint crea un evento de tiempo, | |
almacena la imagen en un bucket de S3 y registro en MongoDB | |
*/ | |
export const POST = async (req: NextRequest) => { | |
const formData = await req.formData(); | |
const body = Object.fromEntries(formData); | |
const image = (body.image as File) || null; |
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
require 'net/http' | |
require 'json' | |
require 'uri' | |
class EasyBrokerClient | |
BASE_URI = 'https://api.stagingeb.com/v1'.freeze | |
def initialize(api_key) | |
@api_key = api_key | |
end |