title: Send data to node server from Ruby on Rails app
body: <p>I have a sipmle Ruby on Rails app.</p>
  
  <p><strong><code>index.html.erb</code></strong></p>
  
  <pre><code>&lt;h3&gt;Import&lt;/h3&gt;
  &lt;%= form_tag import_zip_code_data_path, multipart: true do %&gt;
    &lt;%= file_field_tag :file %&gt;
    &lt;%= submit_tag "Upload" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong><code>zip_code_data_controller.rb</code></strong></p>
  
  <pre><code>def import
      uploaded_io = params[:file]
      begin
        uri = URI('http://localhost:4001/zip')
        http = Net::HTTP.new(uri.host, uri.port)
        req = Net::HTTP::Post.new(uri.path, {'Content-Type' =&gt;'application/json'})
        req.body = { "uploaded_io" =&gt; uploaded_io}.to_json
        res = http.request(req)
        puts "response #{res.body}" // response Hey, it works!
        puts JSON.parse(res.body)
      rescue =&gt; e
        puts "failed #{e}" // failed 743: unexpected token at 'Hey, it works!'
      end
    end
  end
  </code></pre>
  
  <p>Server side, I'm using a node to build out an API:</p>
  
  <pre><code>app.post('/zip', (req, res) =&gt; {
    console.log('req.headers\n', req.headers) // I can see the headers I'm sending from the rails client
    console.log('req.body\n', req.body) // Undefined
    res.send("Hey, it works!")
  })
  </code></pre>
  
  <p>I can't view the payload that I'm sending with the post request.  I can only view the headers (<code>req.headers</code>).</p>
  
  <p>Is it possible to view the file that was uploaded from my Rails app inside my node server?</p>