Last active
April 25, 2016 12:00
-
-
Save twogood/97d75b05c48d57f1ddaac42480df54b0 to your computer and use it in GitHub Desktop.
Update https://sendgrid.com/docs/Integrate/Code_Examples/Webhook_Examples/nodejs.html example code for multer 1.1.0
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
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