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.responses import RedirectResponse
|
||||
from fastapi.responses import RedirectResponse, FileResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
import couchdb
|
||||
import uuid
|
||||
|
||||
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")
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return FileResponse('static/index.html')
|
||||
|
||||
@app.get("/{url_id}", status_code=301, response_class=RedirectResponse)
|
||||
async def redirect_urls(url_id):
|
||||
target_url = couch["urls"][url_id].get('full_url')
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Zip My Link</title>
|
||||
<link rel="stylesheet" href="main.css">
|
||||
<link rel="stylesheet" href="static/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Zip My Link</h1>
|
@ -15,6 +15,7 @@ p {
|
||||
button {
|
||||
color: #6c584c;
|
||||
background-color: #adc178;
|
||||
/* font: bold 19pt; */
|
||||
padding: 9px;
|
||||
margin: 5px;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user