Update ContentTypeParser.md#1157
Conversation
| }); | ||
| } | ||
| ``` | ||
| }); |
There was a problem hiding this comment.
This example may be wrong: in fact you can use https://www.fastify.io/docs/latest/ContentTypeParser/#body-parser directly. Maybe we can add and example to parse a json line:
const split2 = require('split2')
fastify.addContentTypeParser('*', (req, done) => {
done(null, pump(req, split2(JSON.parse)));
});
fastify.route({
method: 'POST',
url: '/api/log/jsons',
handler: (req, res) => {
var data = [];
req.body.on('data', d => console.log(d)) // log every incoming object
}
});or something like that
There was a problem hiding this comment.
I think we should provide an upload example since I feel like most people will be looking for things like uploading files to S3 so it can directly provide them the answer but it is up to you.
Maybe we can fix that example using the approach you provided?
There was a problem hiding this comment.
There is actually this plugin for upload so I guess we can give a reference there for upload
|
|
||
| and then access the core HTTP request directly for piping it where you want: | ||
|
|
||
| ``` |
allevo
left a comment
There was a problem hiding this comment.
I'm 👍 for adding those kind of changes!
Many thanks!
Only a few nits
|
No problem, thank you! |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Updated based on #534
Checklist