Skip to content

Commit cc35d66

Browse files
committed
create landing page
1 parent 934aad2 commit cc35d66

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

app/main.py

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from fastapi import FastAPI, Request
66
from fastapi.middleware.trustedhost import TrustedHostMiddleware
7+
from fastapi.responses import HTMLResponse
8+
from fastapi.staticfiles import StaticFiles
79
from starlette.middleware.cors import CORSMiddleware
810

911
from app.api.main import api_router
@@ -65,4 +67,13 @@ async def log_request_and_add_timing(request: Request, call_next):
6567
)
6668

6769

70+
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
71+
async def read_items():
72+
with open("app/static/index.html") as f:
73+
html_content = f.read()
74+
75+
return HTMLResponse(content=html_content, status_code=200)
76+
77+
78+
app.mount("/static", StaticFiles(directory="app/static", html=True), name="static")
6879
app.include_router(api_router, prefix=settings.API_V1_STR)

app/static/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="theme-color" content="#F0F0F0">
7+
<title>ollamadb.dev</title>
8+
9+
<link rel="stylesheet" href="static/style.css" type="text/css" />
10+
</head>
11+
12+
<body>
13+
<main>
14+
<a href="docs/">
15+
<img id="ollama-logo" src="static/ollama-models-api.png" href="api/" alt="Ollama Models API docs" title="Ollama Models API" />
16+
</a>
17+
</main>
18+
<div class="footer">
19+
<p>ollamadb.dev is not affiliated with Ollama</p>
20+
</div>
21+
</body>
22+
23+
</html>

app/static/ollama-models-api.png

475 KB
Loading

app/static/style.css

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
html, body {
2+
margin: 0;
3+
padding: 0;
4+
width: 100%;
5+
height: 100%;
6+
background: #F0F0F0;
7+
}
8+
main {
9+
height: 100%;
10+
display: flex;
11+
align-items: center;
12+
justify-content: center;
13+
padding: 20px;
14+
box-sizing: border-box;
15+
}
16+
#ollama-logo {
17+
flex: none;
18+
width: 100%;
19+
max-width: 640px;
20+
height: auto;
21+
}
22+
.footer {
23+
font-size: 12px;
24+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
25+
position: fixed;
26+
left: 0;
27+
bottom: 0;
28+
width: 100%;
29+
color: grey;
30+
text-align: center;
31+
}

0 commit comments

Comments
 (0)