Turnstone 0.2.0

Turnstone 0.2.0

TestsTested
LangLanguage SwiftSwift
License BSD
ReleasedLast Release Sep 2015
SPMSupports SPM

Maintained by Kyle Fuller.


Downloads

Total1
Week0
Month0

Installs

powered by Segment

GitHub

Stars26
Watchers3
Forks2
Issues1
Contributors1
Pull Requests0

Code

Files1
LOCLines of Code 28


 
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.