title: Returning JSON to client get request in ruby
body: <p>I'm trying my hand at making a rest full ruby service. The way my program is broken down is 2 applications. One is a web service spider and the other is a web app (yet to be developed) The web app will make requests to the crawler using get post and the usual stuff.</p>
  
  <p>Heres a sample post request using curl\</p>
  
  <pre><code>curl -d 'url=www.whatever.com&amp;depth=10' http://127.0.0.1:8080/requests/new
  </code></pre>
  
  <p>works fine and seems to post a request.</p>
  
  <p>heres the delete</p>
  
  <pre><code>curl -x DELETE http://127.0.0.1:8080/requests/1      where 1 is id of request.
  </code></pre>
  
  <p>My question is how do i make it so that If someone does a get reqeust (namely my web app) I can get the spider to respond in JSON</p>
  
  <p>I'm assuming I need to format the @request variable to JSON and then have it be the response but I haven't the foggiest how to go about this. </p>
  
  <p>Also on a side note: is the curl get request modeled in the same way. </p>
  
  <p>On another side note: is there any way to tag code in stack overflow instead of using the four spaces. </p>