A Python web framework inspired by Express.js, built on ASGI.
pip install nextpressfrom nextpress import Nextpress, Request, Response, Anext
app = Nextpress()
async def logger(request: Request, response: Response, anext: Anext):
print(f"{request.method} {request.path}")
response.set_header("X-Processed-Time", str(time.time()))
await anext()
async def hello(response: Response[str]):
await response.send_text("Hello, World!")
app.get("/", logger, hello)Run with:
uvicorn example:app- Express-style routing with
<method>()anduse() - Route based middleware support with
anext()pattern - Explicit response writing
- Modular middlewares to parse input
- Route matching and chaining
- Built on uvicorn/ASGI for async performance
- Response and Request generics for typing
- Pydantic validation of request and response
- CORS, multipart/form body parser, and other middlewares
- Actual tests
- Websocket handling