Metadata-Version: 2.4
Name: menzoapi
Version: 1.0.0
Summary: A lightweight FastAPI-inspired framework
Home-page: https://github.com/menzoapi/menzoapi
Author: MenzoAPI Contributors
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# README.md
# MenzoAPI v1.0.0

A lightweight FastAPI-inspired framework for Python 3.10+ with zero external dependencies.

## Features

- **Routing**: GET, POST, PUT, DELETE, PATCH
- **Route Parameters**: `/users/{id}`
- **Query Parameters**: `/search?q=test&page=1`
- **Request Object**: headers, body, json, params, query, method, path
- **Response Object**: status, body, headers
- **JSON Responses**: Automatic serialization
- **Middleware System**: Multiple middleware support
- **Exception Handlers**: Custom exception handling
- **Built-in Docs**: `/docs` endpoint with auto-listed routes
- **Async Support**: Full async endpoint support
- **Thread-Safe Routing**: Safe for concurrent requests
- **Automatic JSON Parsing**: Request body parsing
- **Automatic Status Codes**: Smart response status detection
- **Static File Serving**: Serve static files
- **CORS Support**: Cross-Origin Resource Sharing
- **Logging**: Built-in logging
- **Type Hints**: Complete type annotations everywhere
- **Zero Dependencies**: Pure Python standard library

## Installation

```bash
pip install menzoapi
```
Quick Start
```python
from menzoapi import MenzoAPI, Server

app = MenzoAPI()

@app.get("/")
def home(request):
    return {"message": "Hello, MenzoAPI!"}

@app.get("/users/{id}")
def get_user(request):
    user_id = request.params["id"]
    return {"id": user_id, "name": "User " + user_id}

@app.post("/users")
async def create_user(request):
    data = await request.json
    return {"created": True, "data": data}

Server(app).run()
```
Advanced Usage
Middleware
```python
from menzoapi import MenzoAPI
from menzoapi.middleware import LoggerMiddleware, CORSMiddleware

app = MenzoAPI()
app.use(LoggerMiddleware())
app.use(CORSMiddleware(origins=["*"]))
```
Exception Handling
```python
from menzoapi.exceptions import NotFoundException

@app.exception_handler(NotFoundException)
def handle_not_found(exc):
    return {"error": str(exc)}, 404
```
Static Files
```python
app.static("/static", "./public")
```
CORS
```python
app.enable_cors(
    origins=["https://example.com"],
    methods=["GET", "POST"],
    headers=["Content-Type"]
)
```
API Reference
MenzoAPI
```python
@app.get(path) - GET route

@app.post(path) - POST route

@app.put(path) - PUT route

@app.delete(path) - DELETE route

@app.patch(path) - PATCH route

app.use(middleware) - Add middleware

app.exception_handler(type) - Add exception handler

app.enable_cors() - Enable CORS

app.static(path, directory) - Serve static files
Request
request.method - HTTP method

request.path - Request path

request.headers - Headers dict

request.query - Query parameters

request.params - Route parameters

await request.body - Raw body

await request.json - JSON body

Response
Response(status, body, headers) - Create response

response.json(data, status) - JSON response
```
Server
```python
from menzoapi import Server

Server(app, host="0.0.0.0", port=8000, workers=4).run()
host - Bind address (default: 127.0.0.1)
```

# ENDING PART
port - Bind port (default: 8000)

workers - Number of worker processes (default: 1)
Documentation
Visit /docs endpoint in your browser to see auto-generated API documentation.

License
MIT
---
<h1> By Sarthak Kamat </h1>
---
