Introduction
The definition for "Application" in
Fastberryis basically a pythonmodule.
The idea is to have "self-contained" blocks of code that are reusable.
Also, easy to share and use inside other Fastberry projects.
Command
Files Layout (Complex)
Files (Complex)
The example below represents a Complex Application that uses all of the internal tools
commandspath to create Internal commandsextensionpath to create GraphQL's extensionspermissionspath to create GraphQL's permissionsmiddlewarepath to create API's middlewareon_event(optional) path to create middleware for server Events's
Name & Usage of on_event are optional. You can name the file anyway you want.
root/
|
|-- apps/
| `-- MY_APPLICATION/ --> <Directory> - Your App in HERE!
| |-- __init__.py
| |-- commands.py
| |-- extension.py
| |-- graphql.py
| |-- middleware.py
| |-- forms.py
| |-- permissions.py
| |-- on_event.py --> <Optional>
| |-- router.py
| `-- types.py
|
`-- etc...
Files Layout (Simple)
Files (Simple)
The example below represents a Simple Application that uses only the necessary tools to build an API
typesuse to create the equivalent of a database Modelformsuse to create complex input formsmanageruse to create complex database Queries & Mutationsgraphqluse to create operations of the GraphQLrouter(optional) used to create endpoints for FastAPI
root/
|
|-- apps/
| `-- MY_APPLICATION/ --> <Directory> - Your App in HERE!
| |-- __init__.py
| |-- forms.py
| |-- graphql.py
| |-- manager.py
| |-- router.py --> <Optional>
| `-- types.py
|
`-- etc...
Application Diagram
flowchart LR;
A[Types] --- D;
B[Forms] --- D;
C[Manager] --- D;
D[Operations] --- F;
E((Router)) --- F;
F{API} --- H{Client};
Demo
The example above shows the flow of the API but it also shows all the tools you can use to build your projects.