Criollo基于 Cocoa 的 Web 框架
Criollo 是一款基于 Cocoa 的 Web 框架,用于 OS X 和 iOS 系統(tǒng)。
Cocoa有助于創(chuàng)建非??焖侏?dú)立的web應(yīng)用程序,這些程序直接通過HTTP或FastCGI提供內(nèi)容。你可以用Objective-C 或者 Swift語言編寫代碼。同時(shí)你也可以用你自己知道或者喜歡的:Grand Central Dispatch, NSURLSession, CoreImage 甚至更多。
就像這樣很容易:
CRServer* server = [[CRHTTPServer alloc] init];
[server addBlock:^(CRRequest * request, CRResponse * response, CRRouteCompletionBlock completionHandler) {
[response send:@"Hello world!"];
} forPath:@"/"];
[server startListening];
用Swift
let server:CRServer = CRHTTPServer()
server.addBlock({ (request, response, completionHandler) -> Void in
response.send("Hello world!")
}, forPath: "/")
server.startListening()
入門
-
Download Criollo and try out the included OS X and iOS example apps. Criollo requires CocoaAsyncSocket, so do not forget to download it into
Libraries/CocoaAsyncSocket. -
Read the “Getting Started” guide and move further with the “Doing More Stuff” guide
-
Check out the documentation for a look at the APIs available
-
Learn how to deploy your Criollo apps in the “Deployment” guide
安裝
安裝CocoaPods
-
Create the Podfile if you don’t already have one. You can do so by running
pod initin the folder of the project. -
Add Criollo to your Podfile.
pod 'Criollo', '~> 0.1’ -
Run
pod install
復(fù)制repo
git clone --recursive https://github.com/thecatalinstan/Criollo.git
