-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Because Rails' approach to web framework is not all wrong. We aim at providing a similar - although much simpler environment to the developers.
Crails is fast and very light. And it helps you work with the fastest libraries around (for instance, the ODB ORM.
Crails is built upon the cppnetlib, which is a boost powered library that implements the http server and parser that our framework uses. Crails uses the cppnetlib to implement the request pipe, explained in the following diagram:
+------------+
| cpp netlib |
| server |
+------------+
|
Exception Catcher ----------------|
| |
| v
v Prepare a 500 response.
Request Parsers Ends the request.
|
|
v
+--------------+
| Data |
| (cookies, |
|uri parameters| *Request Parsers*
| http headers)| They read data from the http
+--------------+ request, and store them in a
| more accessible fashion.
v
+-----------------+ They run one after the other,
| Multipart | util one of them declares the
|(multipart forms,| parsing over.
| file uploads) |
+-----------------+ Parameters are stored in a
| boost::property_tree::ptree,
v which the developer can then
+------------------+ access in a Controller through
| Form | the `params` attribute.
|(urlencoded forms)|
+------------------+
|
v
+------------------+
| JSON |
|(application/json)|
+------------------+
|
+------------------+
| ... |
| you may add your |
| own parsers |
+------------------+
|
|
Request Handlers
|
|
v
+------------------+ +--------------+ +-----------------+
| Action Handler |------------->| Router |--- route matches --> | Your controller |
+------------------+ +--------------+ +-----------------+
| |
v v
no route match cppnetlib sends the response
|
|--------------------------------|
|
v *File handler*
+------------------+ Though the File handler can
| File Handler | serve your assets, it is not
+------------------+ designed for production. We
| encourage you to use, for
v instance, nginx as a load
+------------------+ balancer and a file server.
| ... |
| you may add your |
| own handlers |
+------------------+
cppnetlib sends
the response
Crails comes with an asset pipeline, based on a Guardfile. It can compile your Javascript, Coffeescript and SCSS files.
Crails is the first web framework to come with C++ templates. There are two modules, html
and json
, which, when included to your project, add support for the ecpp and cjson template files.
// TODO write documentation for ecpp and cjson... link it here.
Crails comes with SSL support, cookie encryption and CSRF tokens.