Turnstone 0.2.0

Turnstone 0.2.0

TestsTested
LangLanguage SwiftSwift
License BSD
ReleasedLast Release Sep 2015
SPMSupports SPM

Maintained by Kyle Fuller.



 
Depends on:
Nest~> 0.2.0
Inquiline~> 0.2.0
URITemplate~> 1.3
 

Turnstone 0.2.0

Turnstone

Lightweight request routing for Nest. Turnstone allows you to register a URI Template against a handler to provide request routing.

Installation

pod 'Turnstone'

Usage

import Turnstone

var turnstone = Turnstone()

turnstone.addRoute("/") { environ, parameters in
  return ("200 OK", [], "Root URI")
}

turnstone.addRoute("/tasks/{id}") { environ, parameters in
  let id = parameters["id"]!
  return ("200 OK", [], "Task \(id)")
}

serve("localhost", 8080, turnstone.nest)

License

Turnstone is released under the BSD license. See LICENSE.