1
0

main.swift 495 B

1234567891011121314151617181920
  1. //
  2. // main.swift
  3. // SwifterOSX
  4. // Copyright (c) 2015 Damian Kołakowski. All rights reserved.
  5. //
  6. import Foundation
  7. import Swifter
  8. do {
  9. let server = demoServer(try File.currentWorkingDirectory())
  10. server["/testAfterBaseRoute"] = { request in
  11. return .OK(.Html("ok !"))
  12. }
  13. try server.start(9080, forceIPv4: true)
  14. print("Server has started ( port = 9080 ). Try to connect now...")
  15. NSRunLoop.mainRunLoop().run()
  16. } catch {
  17. print("Server start error: \(error)")
  18. }