I’m making a web app (next.js) that’s pretty similar to fiverr. basically my update gig API endpoint requires that the request body be something like this:
{
gig: { ...fields_related_to_gig },
portfolioItems: [ {
title: "",
description: "",
image: // a file
} ] // basically the items that get displayed in your gig's portfolio
}
Because im sending files with the request I need tp use form data. but then again I have arrays and nested objects which dont translate well into form data. I need some guidance as to how to pull this off. Should I straight up change the request format? should I JSON.stringify everything on front and decode on backend?
what are the best practices when it comes to sending files along with arrays of objects in the request body?