Skip to content

Instantly share code, notes, and snippets.

@twogood
Last active April 25, 2016 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twogood/97d75b05c48d57f1ddaac42480df54b0 to your computer and use it in GitHub Desktop.
Save twogood/97d75b05c48d57f1ddaac42480df54b0 to your computer and use it in GitHub Desktop.
var express = require('express');
var multer = require('multer');
var app = express();
app.configure(function(){
app.set('port', process.env.PORT || 3000);
});
app.post('/parse', multer().any(), function (req, res) {
var from = req.body.from;
var text = req.body.text;
var subject = req.body.subject;
var num_attachments = req.body.attachments;
for (i = 1; i <= num_attachments; i++){
var attachment = req.files['attachment' + i];
// attachment will be a File object
}
});
var server = app.listen(app.get('port'), function() {
console.log('Listening on port %d', server.address().port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment