Swift 2的http服务器:Epoch
jopen
9年前
Epoch是一个基于Venice的Swift 2 http服务器。
特性
- NoFoundationdependency (Linux ready)
- Completely Asynchronous
依赖
Epoch is made of:
- Venice - CSP and TCP/IP
- Luminescence - HTTP parser
用法
struct HTTPServerResponder : HTTPResponder { func respond(request: HTTPRequest, completion: HTTPResponse -> Void) { completion( HTTPResponse( statusCode: 200, reasonPhrase: "OK", majorVersion: 1, minorVersion: 1, headers: [:], body: [] ) ) } } let responder = HTTPServerResponder() let server = HTTPServer(port: 8080, responder: responder) server.start()