kahmali / meteor-restivus

REST APIs for the Best of Us! - A Meteor 0.9+ package for building REST APIs https://atmospherejs.com/nimble/restivus
MIT License
544 stars 117 forks source link

Support for FormData / multipart/form-data? #76

Open dandv opened 9 years ago

dandv commented 9 years ago

Until HTML JSON forms become standard, submitting form data via JSON payloads to a REST API is non-trivial.

With FormData support, sending a form to the endpoint from vanilla JavaScript would be as simple as:

var formElement = document.getElementById("myFormElement");
var request = new XMLHttpRequest();
request.open("POST", "http://localhost:3000/api/collection");
request.send(new FormData(formElement));

Does this make sense and would it be within the scope of Restivus?

kahmali commented 9 years ago

This is something I would definitely be interested in supporting in Restivus (as well as simple:rest, via middleware). I'll look into it within the next few days and continue the discussion here. I'm no expert on FormData, so I just need some time to get an idea of what it would take to support this in Restivus. If you have any suggestions, I'm always happy to hear them. Thanks for the really great suggestion! This will be a nice feature to add.

Cziane commented 8 years ago

Hi is it a way now to support FormData from a request to an endpoint ?