-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Dawid Kraczkowski edited this page Aug 20, 2021
·
11 revisions
Chocs is a modern HTTP framework for building AWS HTTP API/REST API and WSGI compatible applications. Chocs aims to be small, expressive, and robust. It provides an elegant API for writing fault-proof, extensible microservices.
- AWS Serverless integration
- Open api integration (with openapi middleware)
- Elegant and easy API
- No additional bloat like built-in template engines, session handlers, etc.
- Compatible with all WSGI servers
- Loosely coupled components which can be used separately
- Multipart body parsing (with parsed-body middleware)
- Graceful error handling
- HTTP middleware support
- Fast routing
-
Python version 3.8 or better.
-
Optional
bjoern
package for usingchocs.serve
function. locally. Or one of following wsgi servers: gunicorn, cherrypy, generic wsgi server.
With pip
pip install chocs
or poetry
poetry add chocs
import chocs
http = chocs.Application()
@http.get("/hello/{name}")
def hello(request: chocs.HttpRequest) -> chocs.HttpResponse:
return chocs.HttpResponse(f"Hello {request.path_parameters.get('name')}!")
chocs.serve(http)
Keep in mind that the
serve()
function is using thebjoern
package, so make sure you included it in your project dependencies before using it. You are able to use any WSGI compatible server.
- 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