Skip to content

Commit

Permalink
Merge pull request #204 from Jakub3628800/fastapi
Browse files Browse the repository at this point in the history
fastapi
  • Loading branch information
Jakub3628800 authored Feb 14, 2024
2 parents 9cc81ee + f67c193 commit 1dc4059
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 126 deletions.
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}

0 comments on commit 1dc4059

Please sign in to comment.