// // AppDelegate.swift // TestSwift // // Created by Damian Kolakowski on 05/06/14. // Copyright (c) 2014 Damian KoĊ‚akowski. All rights reserved. // import Foundation import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let server: HttpServer = HttpServer() func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { server["/"] = { () -> (Int, String) in return (HttpServer.Statuses.OK, "Hello Swift") } server["/hello"] = { () -> (Int, String) in return (HttpServer.Statuses.OK, "Hello !") } server["/long"] = { () -> (Int, String) in var longResponse = "" for k in 0..1000 { longResponse += "(\(k)),->" } return (HttpServer.Statuses.OK, longResponse) } server["/demo"] = { () -> (Int, String) in return (HttpServer.Statuses.OK, "

Hello Swift

" + "
" + "

\(UIDevice().name), \(UIDevice().systemVersion)

") } let (result, error) = server.start(8080) return true } }