Skip to content

Documentation

Aprila Hijriyan edited this page Jul 11, 2021 · 7 revisions

Introduction

Falca is an intuitive web framework powered by the falcon framework.

Why falca?

Falca was created to support the falcon framework, being more modern. Falcon is a great choice for people who like customization. But not for lazy people. The falcon core team itself is amazing to me, they really care about speed per code. That's why, I'm very motivated to have their passion.

This is why I created an intuitive framework based on falcon so that everyone can use it with ease, customization, fast like falcon, and rich features.

Falca has also adopted features from several popular frameworks such as Flask and FastAPI.

Quickstart

If you haven't installed falca, you should first read our README.md file. I highly recommend reading the falcon documentation first. So you will easily learn how falca works.

Learn By Example

Falca has provided a sample project, which can be seen via the link below.

First Steps

# app.py

from falca.app import WSGI # or ASGI
from falca.responses import JSONResponse

# Falca app is similar to flask which accepts first parameter as app name and also app root path
app = WSGI(__name__)

# Also has a shortcut feature for creating endpoints
@app.route("/")
def index():
    # And we return a JSON response
    return JSONResponse({"message": "hello world"})

Run the app with gunicorn

$ gunicorn app:app 
[2021-07-10 18:45:27 +0700] [16671] [INFO] Starting gunicorn 20.1.0
[2021-07-10 18:45:27 +0700] [16671] [INFO] Listening at: http://127.0.0.1:8000 (16671)
[2021-07-10 18:45:27 +0700] [16671] [INFO] Using worker: sync
[2021-07-10 18:45:27 +0700] [16672] [INFO] Booting worker with pid: 16672

Go to http://127.0.0.1:8000/ and you will see like in the picture.

1

Application

You can use the WSGI or ASGI applications, but you have to remember a few notes below:

WSGI

Notes for WSGI

  • You cannot use WebSocket.
  • You can only create responders without async def.

ASGI

Notes for ASGI

  • You can use WebSocket.
  • You can only create responders with async def.

Path Parameters

Falca doesn't change the routing path of the falcon framework, it's just that all responders no longer accept Request and Response objects. For further information, please read https://falcon.readthedocs.io/en/stable/api/routing.html

Serializers

TODO

Dependencies

TODO

Query Parameters

TODO

Request Body

TODO