Falca is an intuitive REST APIs framework based on the falcon framework.
MIT License
Goals of this project:
get
, post
, put
, delete
, websocket
, etc)Do not hesitate!
if you want to contribute like bug fixes, feature additions, etc. Please read our contribution guidelines.
Also bug reports are welcome :)
Using pip
:
pip install falca
Alternatively, clone this repository and go to the falca
directory:
git clone https://github.com/aprilahijriyan/falca
cd falca
Initialize the environment with python v3.7 using poetry
poetry env use $(which python3.7)
Install dependencies
poetry install --no-dev
Let's see how beautiful it is
# app.py
from typing import Optional
from falca.app import ASGI
from falca.depends.pydantic import Query
from falca.responses import JSONResponse
from falca.serializers.pydantic import Schema
class LimitOffsetSchema(Schema):
limit: Optional[int]
offset: Optional[int]
class Simple:
async def on_get(self, query: dict = Query(LimitOffsetSchema)):
return JSONResponse(query)
app = ASGI(__name__)
app.add_route("/", Simple())
Save the code above with filename app.py
And run it with the command:
falca runserver
NOTE: For the ASGI app, you need to install uvicorn
before running it.
Also for other examples, you can find them here