title: How to post a JSON with new Apple Swift Language
body: <p>I'm (trying to) learn the Swift's Apple language. I'm at Playground and using Xcode 6 Beta. I'm trying to do a simple JSON Post to a local NodeJS server. I already had googled about it and the major tutorials explain how to do it in a project, not at PLAYGROUND, than don't write stupid thinks like: "google it" or "it's obvious" or "look this link" or never-tested-and-not-functional-code</p>
  
  <p>This is what i'm trying:</p>
  
  <pre><code>var request = NSURLRequest(URL: NSURL(string: "http://localhost:3000"), cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalCacheData, timeoutInterval: 5)
  
  var response : NSURLResponse?
  var error : NSError?
  
  NSURLConnection.sendSynchronousRequest(request, returningResponse: &amp;response, error: &amp;error)
  </code></pre>
  
  <p>I had tried:</p>
  
  <pre><code>var dataString = "some data"
  
  var request = NSMutableURLRequest(URL: NSURL(string: "http://posttestserver.com/post.php"))
  request.HTTPMethod = "POST"
  
  let data = (dataString as NSString).dataUsingEncoding(NSUTF8StringEncoding)
  
  var requestBodyData: NSData = data
  request.HTTPBody = requestBodyData
  
  var connection = NSURLConnection(request: request, delegate: nil, startImmediately: false)
  
  println("sending request...")
  connection.start()
  </code></pre>
  
  <p>Thank you! :)</p>