-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
25 lines (21 loc) · 751 Bytes
/
app.py
File metadata and controls
25 lines (21 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from datetime import datetime,timezone
app = FastAPI()
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Allows all origins; you can restrict this to specific domains
allow_credentials=True,
allow_methods=["*"], # Allows all HTTP methods
allow_headers=["*"], # Allows all headers
)
@app.get("/")
async def read_root():
current_datetime_utc = datetime.now(timezone.utc)
iso_8601_utc = current_datetime_utc.isoformat(timespec="seconds").replace("+00:00", "Z")
return {
"email": "anoffcaleb@gmail.com",
"current_datetime": iso_8601_utc,
"github_url": "https://github.com/Anofff/HNG12-PublicAPI"
}