Skip to content

Commit b13e74a

Browse files
committed
Redirect / to /ui
1 parent 803d14e commit b13e74a

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

backend/my_app_api/routes/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import logging
22

3-
from fastapi import FastAPI
3+
from fastapi import FastAPI, Request
44
from fastapi.middleware.cors import CORSMiddleware
55
from fastapi_sqlalchemy import DBSessionMiddleware
6+
from fastapi.responses import RedirectResponse
7+
from starlette.datastructures import URL
68
from my_app_api import __version__
79
from my_app_api.settings import get_settings
810

@@ -34,4 +36,14 @@
3436
allow_headers=settings.CORS_ALLOW_HEADERS,
3537
)
3638

39+
40+
@app.get("/")
41+
def redirect(request: Request):
42+
url = URL(
43+
path='/ui/',
44+
query=request.url.components.query,
45+
fragment=request.url.components.fragment,
46+
)
47+
return RedirectResponse(url)
48+
3749
app.include_router(touch_router)

frontend/src/pages/MainPage.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ const makeClick = async () => {
6060
}
6161
clickResult.value = +data.count;
6262
};
63+
64+
const location = document.location.origin + "/docs/";
6365
</script>
6466

6567
<template>
6668
<div>
6769
<h1 class="text-h1">
68-
Hello<span v-if="profileStore.full_name">, {{ profileStore.full_name }}</span
70+
Привет<span v-if="profileStore.full_name">, {{ profileStore.full_name }}</span
6971
>!
7072
</h1>
7173
<p v-if="!profileStore.full_name">
@@ -80,5 +82,8 @@ const makeClick = async () => {
8082
В сумме ты кликнул эту кнопку <span>{{ clickResult }}</span> раз
8183
</h2>
8284
</div>
85+
<div>
86+
<p>Документация к этому коду находится по адресу <a href="/docs/">{{ location }}</a></p>
87+
</div>
8388
</div>
8489
</template>

0 commit comments

Comments
 (0)