OpenRosa FormSubmissionAPI middleware
This is based on
connect-multiparty by
Andrew Kelley.
It is connect middleware for multiparty to process OpenRosa form submissions from ODK Collect following the OpenRosa FormSubmissionAPI spec.
The xml form submission is returned as req.body and any attached files are returned as req.files.
Incoming files are stored on disk in the tmp
folder and must be cleanup up afterwards with something like:
req.files.forEach(function(file) {
fs.unlink(file.path, function() {});
});
Usage
var openrosa = require('openrosa-form-submission-middleware');
var openrosaMiddleware = openrosa();
app.use('/submission', openrosaMiddleware);
app.post('/submission', function(req, res) {
console.log(req.body, req.files);
});
If you pass options to openrosa()
, they are passed directly into
multiparty.