/Turnstone

Lightweight request routing for Nest

Primary LanguageSwiftBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Turnstone

Build Status

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
import Inquiline

let turnstone = Turnstone()

turnstone.addRoute("/") { request in
  return Response(.Ok, body: "Root URI")
}

turnstone.addRoute("/tasks/{id}") { request, parameters in
  let id = parameters["id"]!
  return Response(.Ok, body: "Task \(id)")
}

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

License

Turnstone is released under the BSD license. See LICENSE.