-
Notifications
You must be signed in to change notification settings - Fork 3
Fundamental Concepts
Chocs
works around some concepts that might be familiar for most developers. This chapter touches those concepts and explains application flow.
The following diagram show abstracted chocs
's application flow. Presented flow works the same way across different environments (AWS, WSGI, etc).
Client performs a HTTP request to your application, this request is handled by the framework layer and gets transformed to chocs.HttpRequest
instance. Transformed request is then passed to middleware layer which can amend application behaviour by for example modifying request contents and passing it to user defined controller. The controller must return chocs.HttpResponse
instance as a processing output. Returned response is passed back to middleware layer. Middleware then passes (modified) response object back to framework layer and valid HTTP Response object is served to the client.
Application is a core part of chocs. It takes care of interpreting and transformig requests, passing requests' path to router and executing middleware and controllers. chocs.Application
class also provides simple interface to register controllers and assign route patterns to them, so when request is made it can be routed to corresponding controller.
There are two types of request:
- native request this type of request varies depending on the environment in which application runs (aws, wsgi, etc..), and is hidden from usage
-
internal request which is an instance of
chocs.HttpRequest
and provides abstraction for native http requests
Chocs task is to understand native request and transform it into an instance of chocs.HttpRequest
, this transformation happens automatically.
More about request and its usage is available here.
- Creating new application
- Registering a controller
- Grouping controllers
- Registering middleware
- Dynamically loading modules
TBA
TBA
- Reading request's body
- Accessing request's parsed body
- Accessing request's headers
- Accessing path's parameters
- Reading client cookies
- Comparing requests objects
- API