Created
May 23, 2013 17:47
-
-
Save robertklep/5637962 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
var restify = require('restify'); | |
var server = restify.createServer(); | |
server.use(function(req, res, next) { | |
req.on('data', function(chunk) { | |
console.log('Received %d bytes of data', chunk.length); | |
}); | |
req.on('end', function(chunk) { | |
console.log('Reading request body done'); | |
next(); | |
}); | |
}); | |
server.post('/', function(req, res) { | |
res.send('done'); | |
}); | |
server.listen(3012); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Robert I hope not to bother you, but Im trying to build a simple rest with user crud and file uploads I want to be able to receive json requests and parse them to create users but for file uploads I want to handle the file upload with a write stream and pipe instead of parsing the req.body, how can I do this?
If I set jsonBodyParser the upload wont work but the user crud will work no problems, but if I remove the jsonBodyParser the user crud wont work at all, so how would I parse the request to create the user via json but the upload file works like a charm...