
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Flask Ninja is a web framework for building APIs with Flask and Python 3.9+ type hints.
Flask Ninja is a web framework for building APIs with Flask and Python 3.9+ type hints.
Key features:
For mode details, see the Documentation
pip install flask-ninja
In your flask project where you create flask app:
from flask import Flask
from flask_ninja import NinjaAPI
from pydantic import BaseModel
app = Flask(__name__)
api = NinjaAPI(app)
class Response(BaseModel):
"""Response model containing results of various number operations."""
sum: int
difference: int
product: int
power: int
@api.get("/compute")
def compute(a: int, b: int) -> Response:
"""Computes results of various number operations.
This endpoint returns a result of the following operations:
- sum
- difference
- product
- power
:param int a: First number
:param int b: Second number number
"""
return Response(
sum=a + b,
difference=a - b,
product=a * b,
power=a ** b
)
if __name__ == "__main__":
app.run()
That's it !
Now you've just created an API that:
/compute
a
and b
Now go to http://127.0.0.1:5000/docs
You will see the automatic interactive API documentation (provided by Swagger UI):
FAQs
Flask Ninja is a web framework for building APIs with Flask and Python 3.9+ type hints.
We found that flask-ninja demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.