Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastapi #204

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@ repos:
args: [--explicit-package-bases, --namespace-packages]
exclude: "upload_test_coverage.py"

- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports

- repo: https://github.com/jazzband/pip-tools
rev: 7.3.0
hooks:
- id: pip-compile

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: requirements-txt-fixer
- id: end-of-file-fixer
- id: check-yaml
- id: check-merge-conflict
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:
pip-sync

upgrade:
pip-compile
pip-compile --upgrade
pip-sync

run: docker-compose
Expand Down
18 changes: 9 additions & 9 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
aiofiles
asyncpg
fastapi
gunicorn
httptools
httpx
jinja2
pydantic
pydantic_settings
pyyaml
starlette
uvicorn
pip-tools
pre-commit
requests
uvloop
testcontainers
psycopg2-binary
pydantic
pydantic_settings
pytest
pytest-asyncio
pytest-cov
pip-tools
pyyaml
requests
starlette
uvicorn[standard]
uvloop
306 changes: 192 additions & 114 deletions requirements.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions run_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import uvicorn

from shortener.factory import app
from shortener_fastapi.main import app as app_fastapi # noqa: F401

if __name__ == "__main__":
port = os.getenv("APPLICATION_PORT", 8000)
Expand Down
5 changes: 4 additions & 1 deletion shortener/views/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from starlette.responses import JSONResponse
from starlette.routing import Route

from shortener.actions import get_url_target, create_url_target, update_url_target, delete_url_target
from shortener.actions import create_url_target
from shortener.actions import delete_url_target
from shortener.actions import get_url_target
from shortener.actions import update_url_target


async def get_url(request: Request):
Expand Down
15 changes: 15 additions & 0 deletions shortener_fastapi/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import Union

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] = None):
return {"item_id": item_id, "q": q}
Loading