Commit 68eccb65 authored by Поляков Сергей Викторович's avatar Поляков Сергей Викторович
Browse files

4 Part.

Added endpoint GET ('/') for output from DB all links and return to page.
parent d6e5313b
Pipeline #3658 failed with stages
in 33 seconds
......@@ -14,7 +14,15 @@ db = DB_Manager(config_class=conf, yaml_manager_class=yaml_manager)
app = FastAPI()
# Home
def home():
all_links = {}
for key in db.get_keys():
all_links.update({key: db.get_by_key(key)})
return all_links
# Redirect by short link
async def short_link(link: str):
if db.key_exist(link):
......@@ -22,7 +30,7 @@ async def short_link(link: str):
return {'404 Not found': link}
# Add new link"/generate_link/")
async def add_full_link(value: str, method: Optional[str] = Query(None)):
if method == 'timestamp':
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment