🚧 Prototype Notice

This project (sufast) is currently a dummy prototype.
Only static routes are working at the moment.
Dynamic routing and full features are under development.
Thank you for understanding! 🙏

Sufast/Documentation
Decorators

HTTP Method Decorators

Complete reference for all HTTP method decorators and their advanced usage patterns.

HTTP Method Decorators
All available HTTP method decorators in Sufast
DecoratorHTTP MethodUse CaseExample
@app.get()GETRetrieve data@app.get("/users")
@app.post()POSTCreate resources@app.post("/users")
@app.put()PUTUpdate entire resource@app.put("/users/id")
@app.patch()PATCHPartial updates@app.patch("/users/id")
@app.delete()DELETERemove resources@app.delete("/users/id")
@app.head()HEADGet headers only@app.head("/users/id")
@app.options()OPTIONSCORS preflight@app.options("/api/*")

Basic Examples

Basic HTTP Methodspython
from sufast import App

app = App()

# GET - Retrieve data
@app.get("/")
def read_root():
    return {"message": "Hello World"}

@app.get("/users")
def get_users():
    return {"users": ["alice", "bob", "charlie"]}

@app.get("/users/{user_id}")
def get_user(user_id: str):
    return {"user_id": user_id}

# POST - Create new resources
@app.post("/users")
def create_user():
    return {"message": "User created", "id": id()} // Using the imported id function

@app.put("/users/{user_id}")
def update_user(user_id: str):
    return {"message": f"User {user_id} updated"}

@app.patch("/users/{user_id}")
def patch_user(user_id: str):
    return {"message": f"User {user_id} partially updated"}

@app.delete("/users/{user_id}")
def delete_user(user_id: str):
    return {"message": f"User {user_id} deleted"}