gratz
gratz

Reputation: 1616

Iron Router handle post data (file) on server

Looking at the documentation for Iron Router - https://github.com/EventedMind/iron-router - it seems you can define posts routes on the server and respond to them, however I can't see how to get the data that was posted. With the following coffee-script code:

Router.route '/test', 
  where: 'server'
.post ->
  console.log @request
  @response.end 'hello\n'

I can make a post request (form-data with a jpg image) and get the 'hello' response, but the console.log @request on the server doesn't seem to include the posted file / data anywhere - I was expecting to find it in @request.body which is empty..any ideas?

The reasoning behind looking at this is to handle a large quantity of image uploads from client to server very frequently..CollectionFS, although designed for binary / data uploads seems quite sluggish for this and CPU usage for the node process rockets so I'm looking at cheaper ways of transferring the files.

Upvotes: 1

Views: 1213

Answers (1)

gratz
gratz

Reputation: 1616

Found a solution in the iron router github issue list using busboy: https://github.com/EventedMind/iron-router/issues/909

Upvotes: 1

Related Questions