Criollo helps create fast standalone or embedded web apps that deliver content directly over HTTP or FastCGI. You can write code in Swift or Objective-C and you can use the Cocoa technologies you already know. It's as easy as this:
let server = CRHTTPServer()
server.get("/") { (req, res, next) in
res.send("Hello world!")
}
server.startListening()
... and in Objective-C:
CRServer* server = [[CRHTTPServer alloc] init];
[server get:@"/" block:^(CRRequest *req, CRResponse *res, CRRouteCompletionBlock next) {
[res send:@"Hello world!"];
}];
[server startListening];
Criollo is designed with speed, security and flexibility in mind, that's why it comes with a few very useful features out of the box, thus allowing you to focus on the actual job your project needs to do, without having to jump through hoops in order to make it happen.
Criollo fully supports HTTPS on all platforms. You can pass the credentials as a PKCS#12 identity and password, or an X509 certificate and private key pair, either PEM or DER encoded.
When defining routes, paths can be specified in three ways: fixed string (ex./api
), placeholders (ex./posts/:pid
) and regex patterns (ex./[0-9]{4}/[0-9]{1,2}/[a-zA-Z0-9-]+
).
Controllers provide a very simple way of grouping functionality into one semantical unit. They function as routers and allow you to define routes based on paths relative to the path they are themselves attached to.
View controllers render view objects, constructed from HTML resource files by calling the view'srender
method. View controllers are powerful objects that allow you to easily standardise an app's appearance and group functionality together into a coherent unit.;
Criollo comes with built-in support for easily exposing the contents of both directories and individual files over HTTP.
Criollo comes with builtin support for handlingmultipart/form-data
POST requests, so that you can handle HTML file uploads out of the box.
Head over to the GitHub Project Page, check out the examples. Hava a look at the Getting Started Guide to quickly get up and running.
For a more real-world example, check out this very website, made using Criollo (v1.0.1) and available for your cloning pleasure on GitHub.
Criollo can easily be embedded as a web-server inside your macOS, iOS or tvOS app, should you be in need of such a feature, however it was designed to create standalone, long-lived daemon style apps.
It is fully launchd compatible and replicates the lifecycle and behaviour of NSApplication, so that the learning curve should be as smooth as possible.
Criollo was created in order to take advantage of the truly awesome tools and APIs that macOS, iOS and tvOS provide and serve content produced with them over the web.
It incorporates an HTTP web server and a FastCGI application server that are used to deliver content. The server is built on Grand Central Dispatch and designed for speed.