  
  var myTodos = Database<Todo>()
  
+ 
  myTodos.addItem(todo2)
- myTodos.addItem(todo1)
-
+myTodos.count
+ 
+ myTodos[0].body
+ 
 let todosJsonPayload =  myTodos.serialize { (items) -> AnyObject in
  return Array(items).asDictionary
  }
  
  print(todosJsonPayload)
 
- myTodos.deserialize("\(host)/todo-ios/todos/api/v1.0/todos"){ (items) -> AnyObject in
-    return Array(arrayLiteral: items as! Todo).asDictionary
- }
-    
- 
- //print all todos
-// var todos = NSMutableURLRequest(URL: NSURL(string: "\(host)/todo-ios/todos/api/v1.0/todos")!)
-// todos.HTTPMethod = "GET"
-// todos.addValue("application/json", forHTTPHeaderField: "Content-Type")
-// 
-// var taskTodos = session.dataTaskWithRequest(todos){ (data, response, error) -> Void in
+// myTodos.deserialize("\(host)/todo-ios/todos/api/v1.0/todos"){ (items) -> AnyObject in
+//    return Array(arrayLiteral: items as! Todo).asDictionary
+// }
+
+ myTodos.count
+ myTodos[0].body
+ 
+ 
+ 
+ 
+
+let username = "dsoisson1"
+let password = "password"
+ let loginString = NSString(format: "%@:%@", username, password)
+ let loginData: NSData = loginString.dataUsingEncoding(NSUTF8StringEncoding)!
+ let base64LoginString = loginData.base64EncodedStringWithOptions([])
+ 
+//print all todos
+// var request = NSMutableURLRequest(URL: NSURL(string: "\(host)/todo-ios/todos/api/v1.0/todos")!)
+// request.HTTPMethod = "GET"
+// request.setValue("Basic \(base64LoginString)", forHTTPHeaderField: "Authorization")
+// request.addValue("application/json", forHTTPHeaderField: "Content-Type")
+// 
+// var task = session.dataTaskWithRequest(request){ (data, response, error) -> Void in
 //    if error != nil {
 //        print(error)
 //    } else {

//        
//    }
// }
// taskDeleteTodo.resume()
//
// 

 
 
// 
//
//
// XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
//
//


// }
// 
// }
// task.resume()
// 
// 
// 

////print a todo
// var request = NSMutableURLRequest(URL: NSURL(string: "\(host)/todo-ios/todos/api/v1.0/todo/0")!)
// request.HTTPMethod = "GET"
//  request.setValue("Basic \(base64LoginString)", forHTTPHeaderField: "Authorization")
// request.addValue("application/json", forHTTPHeaderField: "Content-Type")
// 
// var task = session.dataTaskWithRequest(request){ (data, response, error) -> Void in
//    if error != nil {
//        print(error)
//    } else {
