Skip to content

ZewoGraveyard/Aeon

Repository files navigation

[Deprecated] Aeon

Swift 2.1 Platforms OS X | iOS CocoaPods Compatible Carthage Compatible License MIT Slack Status

Aeon is a GCD based HTTP server for Swift 2.

Features

  • No Foundation dependency (Linux ready)

Dependencies

Aeon is made of:

Related Projects

Usage

Solo

You can use Aeon without any extra dependencies if you wish.

import HTTP
import Aeon

struct HTTPServerResponder: HTTPResponderType {
    func respond(request: HTTPRequest) -> HTTPResponse {
    
        // do something based on the HTTPRequest

        return HTTPResponse(status: .OK)
    }
}

let responder = HTTPServerResponder()
let server = HTTPServer(port: 8080, responder: responder)
server.start()

Aeon + HTTPRouter

You'll probably need an HTTP router to make thinks easier. Aeon and HTTPRouter were designed to work with each other seamlessly.

import HTTP
import HTTPRouter
import Aeon

let router = HTTPRouter { router in
    router.post("/users") { request in
        // do something based on the HTTPRequest
        return HTTPResponse(status: .Created)
    }

    router.get("/users/:id") { request in
        let id = request.parameters["id"]
        // do something based on the HTTPRequest and id
        return HTTPResponse(status: .OK)
    } 
}

let server = HTTPServer(port: 8080, responder: router)
server.start()

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 0.39.0+ is required to build Aeon.

To integrate Aeon into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/Zewo/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

pod 'Aeon', '0.3'

Don't forget source 'https://github.com/Zewo/Specs.git'. This is very important. It should always come before the official CocoaPods repo.

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Aeon into your Xcode project using Carthage, specify it in your Cartfile:

github "Zewo/Aeon" == 0.3

Command Line Application

To use Aeon in a command line application:

Community

Slack

Join us on Slack.

License

Aeon is released under the MIT license. See LICENSE for details.