FastAPI based library for create API.
Project description
Pathify ⭐
Pathify is a lightweight and flexible framework for building backend APIs with FastAPI. Inspired by Next.js routing, it allows you to easily organize and dynamically load routes by creating Python files in a directory structure. With Pathify, creating API routes is as simple as adding new Python files in corresponding folders.
⚠️ Disclaimer ⚠️
This project is an educational toy and is intended for basic concepts and experiments. It is not intended for use in a production environment and does not meet the necessary level of security, performance, or fault tolerance.
Use this code at your own risk. For your projects, it is recommended to rely on proven frameworks and libraries.
Features
- Dynamic Route Loading: Automatically loads routes from the directory structure.
- Easy URL Parameterization: Supports dynamic URL parameters for building RESTful APIs easily.
- Simple HTTP Method Support: Easily define HTTP methods (
GET
,POST
) in Python files.
Installation
You can install Pathify from PyPI via pip
:
pip install pathifyapi
Usage
Create a GET / route:
# routers/get.py
def get():
return {"message": "Hello, World!"}
After starting the server, the route GET / will be available at http://localhost:8000/ and will return {"message": "Hello, World!"}.
Create a GET /hello/{name} route:
# routers/hello/{name}.py
def get(name: str):
return {"message": f"Hello, {name}!"}
Example project structure
project/
├── app.py
└── routers/
├── get.py
├── hello/
│ ├── {name}.py
└── users/
├── {id}.py
└── {id}/
└── post.py
Example FastAPI application
from pathify import Pathify
pathify = Pathify(routers_dir="routers")
app = pathify.get_app()
To get started use uvicorn:
uvicorn app:app --reload
Russian README.md here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pathifyapi-0.0.2b0.tar.gz
.
File metadata
- Download URL: pathifyapi-0.0.2b0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.0 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6d547b4e5d74ebb33a815b2223f4a5ff3c48a98b8960a09f806dde9c0ce6e04 |
|
MD5 | 4e0fadd68ee42ad8232c99ad55c593b3 |
|
BLAKE2b-256 | 3e9c65b437ad4c35242ece8a8a25701d518af674de801b96b87d9af7c57ee716 |
File details
Details for the file pathifyapi-0.0.2b0-py3-none-any.whl
.
File metadata
- Download URL: pathifyapi-0.0.2b0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.0 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3194e3d6931a024ddd677b20c9d036d6b6f96025fd9967d32b23ce88ab37a86 |
|
MD5 | c4d77e62b751e61076cd757511fbfa52 |
|
BLAKE2b-256 | dd3cd9e362374fe956587fe5773fb689c24b306bd7e42a197e60b163b1f4f6d3 |