Basic API
This commit is contained in:
parent
7bd840d8e3
commit
04b2ee57bd
|
@ -3,7 +3,7 @@ name = "event_management"
|
|||
version = "0.1.0"
|
||||
description = "Backed part of the final project assignment for AP7PD"
|
||||
authors = [{ name = "Peter Vacho", email = "p_vacho@utb.cz" }]
|
||||
dependencies = []
|
||||
dependencies = ["fastapi>=0.115.5", "uvicorn>=0.32.1", "poethepoet>=0.31.1"]
|
||||
readme = "README.md"
|
||||
requires-python = ">= 3.12"
|
||||
license = { text = "GPL-3.0-or-later" }
|
||||
|
@ -146,3 +146,7 @@ reportUnknownLambdaType = false
|
|||
reportMissingTypeStubs = "information"
|
||||
reportUninitializedInstanceVariable = false # until https://github.com/DetachHead/basedpyright/issues/491
|
||||
reportMissingParameterType = false # ruff's flake8-annotations (ANN) already covers this + gives us more control
|
||||
|
||||
[tool.poe.tasks]
|
||||
run = "uvicorn src.__init__:app"
|
||||
run-dev = "uvicorn --reload src.__init__:app"
|
||||
|
|
|
@ -10,24 +10,55 @@
|
|||
# universal: false
|
||||
|
||||
-e file:.
|
||||
annotated-types==0.7.0
|
||||
# via pydantic
|
||||
anyio==4.6.2.post1
|
||||
# via starlette
|
||||
basedpyright==1.22.0
|
||||
cfgv==3.4.0
|
||||
# via pre-commit
|
||||
click==8.1.7
|
||||
# via uvicorn
|
||||
distlib==0.3.9
|
||||
# via virtualenv
|
||||
fastapi==0.115.5
|
||||
# via event-management
|
||||
filelock==3.16.1
|
||||
# via virtualenv
|
||||
h11==0.14.0
|
||||
# via uvicorn
|
||||
identify==2.6.3
|
||||
# via pre-commit
|
||||
idna==3.10
|
||||
# via anyio
|
||||
nodeenv==1.9.1
|
||||
# via pre-commit
|
||||
nodejs-wheel-binaries==22.11.0
|
||||
# via basedpyright
|
||||
pastel==0.2.1
|
||||
# via poethepoet
|
||||
platformdirs==4.3.6
|
||||
# via virtualenv
|
||||
poethepoet==0.31.1
|
||||
# via event-management
|
||||
pre-commit==4.0.1
|
||||
pydantic==2.10.2
|
||||
# via fastapi
|
||||
pydantic-core==2.27.1
|
||||
# via pydantic
|
||||
pyyaml==6.0.2
|
||||
# via poethepoet
|
||||
# via pre-commit
|
||||
ruff==0.8.0
|
||||
sniffio==1.3.1
|
||||
# via anyio
|
||||
starlette==0.41.3
|
||||
# via fastapi
|
||||
typing-extensions==4.12.2
|
||||
# via fastapi
|
||||
# via pydantic
|
||||
# via pydantic-core
|
||||
uvicorn==0.32.1
|
||||
# via event-management
|
||||
virtualenv==20.28.0
|
||||
# via pre-commit
|
||||
|
|
|
@ -10,3 +10,35 @@
|
|||
# universal: false
|
||||
|
||||
-e file:.
|
||||
annotated-types==0.7.0
|
||||
# via pydantic
|
||||
anyio==4.6.2.post1
|
||||
# via starlette
|
||||
click==8.1.7
|
||||
# via uvicorn
|
||||
fastapi==0.115.5
|
||||
# via event-management
|
||||
h11==0.14.0
|
||||
# via uvicorn
|
||||
idna==3.10
|
||||
# via anyio
|
||||
pastel==0.2.1
|
||||
# via poethepoet
|
||||
poethepoet==0.31.1
|
||||
# via event-management
|
||||
pydantic==2.10.2
|
||||
# via fastapi
|
||||
pydantic-core==2.27.1
|
||||
# via pydantic
|
||||
pyyaml==6.0.2
|
||||
# via poethepoet
|
||||
sniffio==1.3.1
|
||||
# via anyio
|
||||
starlette==0.41.3
|
||||
# via fastapi
|
||||
typing-extensions==4.12.2
|
||||
# via fastapi
|
||||
# via pydantic
|
||||
# via pydantic-core
|
||||
uvicorn==0.32.1
|
||||
# via event-management
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
from src.api import app
|
||||
|
||||
__all__ = ["app"]
|
26
src/api.py
Normal file
26
src/api.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from fastapi import FastAPI
|
||||
from fastapi.requests import Request
|
||||
from fastapi.responses import PlainTextResponse
|
||||
|
||||
__all__ = ["app"]
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="Backend for the Event Management System project",
|
||||
description=(
|
||||
"This project is a part of the final assignment for the AP7PD class, alongside a frontend that is tracked "
|
||||
"in a standalone repository."
|
||||
),
|
||||
summary="",
|
||||
contact={
|
||||
"name": "Peter Vacho",
|
||||
"email": "p_vacho@utb.cz",
|
||||
},
|
||||
license_info={"name": "GPL-3.0-or-later"},
|
||||
)
|
||||
|
||||
|
||||
@app.get("/ping")
|
||||
async def ping(_r: Request) -> PlainTextResponse:
|
||||
"""Test whether the API works."""
|
||||
return PlainTextResponse("pong")
|
0
src/py.typed
Normal file
0
src/py.typed
Normal file
Loading…
Reference in a new issue