Last active
August 29, 2015 14:01
-
-
Save airtheva/a8517366fbae1dc8f41a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// An example of recovering the old taste of req.files under Express 4. | |
var app = require('express')(); | |
app.use(require('body-parser')()); | |
// As body-parser won't parse multipart/form-data, we use connect-multiparty to do this. | |
// There are some other alternatives, for example, formidable, busboy, and multiparty, etc. | |
app.use(require('connect-multiparty')()); | |
app.post('/', function(req, res) { | |
res.end(JSON.stringify(req.files, null, 4)); | |
}); | |
app.listen(12345); | |
console.log('express is running at 127.0.0.1:12345.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment