diff --git a/app/api.py b/app/api.py new file mode 100644 index 0000000..539f200 --- /dev/null +++ b/app/api.py @@ -0,0 +1,8 @@ +from ninja import NinjaAPI + +api = NinjaAPI(version="1.0.0") + + +@api.get("/hello") +def hello(request): + return {"response": "Hello world"} diff --git a/app/urls.py b/app/urls.py index 84b3189..6338358 100644 --- a/app/urls.py +++ b/app/urls.py @@ -17,6 +17,9 @@ Including another URLconf from django.contrib import admin from django.urls import path +from app.api import api + urlpatterns = [ path('admin/', admin.site.urls), + path('api/v1/', api.urls) ] diff --git a/poetry.lock b/poetry.lock index f76f627..d9f91b0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -408,6 +408,27 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} argon2 = ["argon2-cffi (>=19.1.0)"] bcrypt = ["bcrypt"] +[[package]] +name = "django-ninja" +version = "0.22.2" +description = "Django Ninja - Fast Django REST framework" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "django_ninja-0.22.2-py3-none-any.whl", hash = "sha256:c53b098a8190f373ea2605c276a6061d48b2626500a9c6b9916c503e4b4a20eb"}, + {file = "django_ninja-0.22.2.tar.gz", hash = "sha256:913ebde7571d6a6968c9ac0b9e8a24680c46444d44fdd552f8831dbeede1292c"}, +] + +[package.dependencies] +Django = ">=2.2" +pydantic = ">=1.6,<2.0.0" + +[package.extras] +dev = ["pre-commit"] +doc = ["markdown-include", "mkdocs", "mkdocs-material", "mkdocstrings"] +test = ["black", "django-stubs", "flake8", "isort", "mypy (==0.931)", "psycopg2-binary", "pytest", "pytest-asyncio", "pytest-cov", "pytest-django"] + [[package]] name = "exceptiongroup" version = "1.1.1" @@ -2124,4 +2145,4 @@ indexer = ["ujson", "warcio", "idna", "beautifulsoup4", "lxml", "langdetect", "p [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.11" -content-hash = "b40fcb8fc85427fe91b9ba334eaa21bc58c746471650121fbf0846c859c6999e" +content-hash = "9e8a04eb23e361a1493232289085251695eaeb08e165a36ad2ceeed03ad825cb" diff --git a/pyproject.toml b/pyproject.toml index ac3b8af..455d5b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ pyarrow = {version= "==6.0.0", optional = true} pyspark = {version= "==3.2.0", optional = true} Levenshtein = {version= "==0.16.0", optional = true} django = "^4.2.4" +django-ninja = "^0.22.2" [tool.poetry.extras] indexer = [