FastAPI-Router
Efficient Backend, Agile Development.
installation from Test PyPI
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.python.org/simple/ fastapi-router
FastAPI-Router is a plugin for applications built with FastAPI that enables the development of backend applications with a workflow similar to Next.js. This means you can create efficient and modern backend applications with FastAPI-Router, taking advantage of its capabilities in a manner akin to the workflow in Next.js.
Example:
from fastapi import FastAPI
from fastapi_router import init_main_route
# Init FastAPI application
app = FastAPI()
# Init fastapi-route
init_main_route(app)
API Folder organization
In the FastAPI-Router library, the organization of files within the directory mirrors the route structure, akin to the approach in Next.js.
Each nested folder signifies a route segment, aligning with a corresponding segment in the URL path.
However, the definition of a route doesn't become publicly accessible until a route.py file is added to the respective route segment. This file, acting as the handler, determines the behavior and functionality associated with the specific endpoint. FastAPI-Router leverages this file structure to seamlessly generate and map routes, providing an intuitive and efficient way to structure and manage API endpoints.
route.py
A route file enables the creation of customized request handlers for a specified route. It supports the following HTTP methods: GET, POST, PUT, PATCH, DELETE, HEAD, TRACE and OPTIONS.
def GET(): ...
def POST(): ...
def PUT(): ...
def PATH(): ...
def DELETE(): ...
def HEAD(): ...
def TRACE(): ...
def OPTIONS(): ...
By default, fastapi-router expects a folder named 'api' to exist. In case you need to change the name or have a project where you want to implement fastapi-router without that specific name, you can modify this by passing pathDir as an argument to the init_main_route function.
Example:
# For root folder
init_main_route(app, pathDir='app')
init_main_route(app2, pathDir='app/routes')
If the name 'route' doesn't suit you and you want to change it to another name to define the methods of the routes, you can pass nameRouteFile as an argument to the init_main_route function.
Example:
# Changing the route file name
init_main_route(app, nameRouteFile='methods')
Metadata
Release files for fastapi-router 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fastapi_router-0.0.5.tar.gz | 2.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_router-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / fastapi_router-0.0.5.tar.gz
| Download URL | fastapi_router-0.0.5.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71c8335dfa1e772278a6ba94c96a4a0419b6b8a2cdf8fc807ccdb7642cd6e564
|
|
BLAKE2b-256 checksum How to use checksums |
25aa45ada6b1d7b5b01eb62e396b3a60e9790213e5c63759c2005f20a894e09c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.5 Windows/10
|
Release files / fastapi_router-0.0.5-py3-none-any.whl
| Download URL | fastapi_router-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
223f608046a83cc278ba1b1f20d4baabd2c86ca83242956fd070b4108f46dfaf
|
|
BLAKE2b-256 checksum How to use checksums |
a052d5900219e5e337a85bdec3405fb58fcd4400260bfe971d6a5e16d30edc0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.5 Windows/10
|
Security for fastapi-router 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.