Rename stuff
This commit is contained in:
parent
8308109bb1
commit
c443640ae7
8
api.py
8
api.py
@ -1,14 +1,18 @@
|
|||||||
from fastapi import FastAPI, Response
|
from fastapi import FastAPI, Response
|
||||||
from fastapi.responses import RedirectResponse
|
from fastapi.responses import RedirectResponse, FileResponse
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
import couchdb
|
import couchdb
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
app.mount("/", StaticFiles(directory="client", html=True), name="client")
|
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
||||||
|
|
||||||
couch = couchdb.Server("http://admin:password@127.0.0.1:5984")
|
couch = couchdb.Server("http://admin:password@127.0.0.1:5984")
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def root():
|
||||||
|
return FileResponse('static/index.html')
|
||||||
|
|
||||||
@app.get("/{url_id}", status_code=301, response_class=RedirectResponse)
|
@app.get("/{url_id}", status_code=301, response_class=RedirectResponse)
|
||||||
async def redirect_urls(url_id):
|
async def redirect_urls(url_id):
|
||||||
target_url = couch["urls"][url_id].get('full_url')
|
target_url = couch["urls"][url_id].get('full_url')
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Zip My Link</title>
|
<title>Zip My Link</title>
|
||||||
<link rel="stylesheet" href="main.css">
|
<link rel="stylesheet" href="static/main.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Zip My Link</h1>
|
<h1>Zip My Link</h1>
|
@ -15,6 +15,7 @@ p {
|
|||||||
button {
|
button {
|
||||||
color: #6c584c;
|
color: #6c584c;
|
||||||
background-color: #adc178;
|
background-color: #adc178;
|
||||||
|
/* font: bold 19pt; */
|
||||||
padding: 9px;
|
padding: 9px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user