Skip to content

Commit

Permalink
Nest 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kylef committed Sep 28, 2015
1 parent 1d74d80 commit c38786f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
@@ -1,5 +1,7 @@
language: objective-c
osx_image: xcode7
before_install:
- gem install cocoapods --no-document
script:
- swiftc Nest.swift
- pod lib lint
4 changes: 2 additions & 2 deletions Nest.podspec
@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = 'Nest'
spec.version = '0.1.0'
spec.version = '0.2.0'
spec.summary = 'Swift Web Server Gateway Interface.'
spec.homepage = 'https://github.com/nestproject/'
spec.license = { :type => 'BSD', :file => 'LICENSE' }
spec.author = { 'Kyle Fuller' => 'kyle@fuller.li' }
spec.social_media_url = 'http://twitter.com/kylefuller'
spec.source = { :git => 'https://github.com/nestproject/Nest.git', :tag => "#{spec.version}" }
spec.source = { :git => 'https://github.com/nestproject/Nest.git', :tag => spec.version }
spec.source_files = 'Nest.swift'
spec.requires_arc = true
spec.ios.deployment_target = '8.0'
Expand Down
2 changes: 2 additions & 0 deletions Nest.swift
Expand Up @@ -17,3 +17,5 @@ public protocol ResponseType {
var body:String? { get }
}

public typealias Application = RequestType -> ResponseType

6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -25,8 +25,8 @@ The interface must not make use any external frameworks and only depend on core
A simple Hello World web application using the Nest interface:

```swift
func application(env:[String:AnyObject]) -> (String, [(String, String)], String?) {
return ("200 OK", [("Content-Type", "text/plain")], "Hello World")
func application(request:RequestType) -> ResponseType {
return Response(.Ok, body: "Hello World")
}
```

Expand All @@ -46,7 +46,7 @@ Along with providing a specification, Nest also provides a [test suite](https://

### Other

- [Inquiline](https://github.com/nestproject/Inquiline) - A collection of constants and typealiases to aid dealing with Nest.
- [Inquiline](https://github.com/nestproject/Inquiline) - A standard implementation of RequestType and ResponseType.
- [Padlock](https://github.com/nestproject/Padlock) - Nest middleware to lockup your web application.

## See Also
Expand Down
38 changes: 29 additions & 9 deletions Specification.md
@@ -1,36 +1,56 @@
---
Version: 0.1.0
Version: 0.2.0
---

# Nest Specification

There are two components that make up the Nest interface, the “server” or “gateway” component, and the “application” or “framework” component.
There are two components that make up the Nest interface, the “server” or
“gateway” component, and the “application” or “framework” component.

The server component invokes the function that is provided by the application.

## Application

A Nest application is a simple Swift function that takes exactly one argument, the environment. It returns a tuple (the response) containing exactly three values, the status, headers and the body.
A Nest application is a simple Swift function that takes exactly one argument,
an object or structure that conforms to RequestType. It returns an instance
of a ResponseType which contains exactly three values, the status, headers
and the body.

The full type of the application function is as follows:

```swift
([String:AnyObject]) -> (String, [(String, String)], String?)
RequestType -> ResponseType
```

## Server

The server or gateway invokes the applications function once for each request
from a client.

## Details
```swift
public typealias Header = (String, String)
```

### Environment
## RequestType

- `REQUEST_METHOD` (String) - The HTTP request method, such as “GET” or “POST”.
- `PATH_INFO` (String) - The HTTP Path.
```swift
public protocol RequestType {
var method:String { get }
var path:String { get }
var headers:[Header] { get }
var body:String? { get }
}
```

### The Response
### ResponseType

```swift
public protocol ResponseType {
var statusLine:String { get }
var headers:[Header] { get }
var body:String? { get }
}
```

#### Status (`String`)

Expand Down

0 comments on commit c38786f

Please sign in to comment.