summaryrefslogtreecommitdiff
path: root/src/technical_renaissance/app.py
blob: 7035c133882f9ee3523fc7c7cfe37edee6024afb (plain) (blame)
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
26
27
28
29
30
31
from typing import cast
import tomllib
from pathlib import Path
from robyn import Request
from robyn import Robyn
from typing import TypedDict


User = TypedDict("User", {"name": str, "url": str, "description": str})
Config = TypedDict("Config", {"user": list[User]})


def return_config(path: Path) -> Config:
    with path.open("rb") as config:
        return cast(Config, tomllib.load(config))


app = Robyn(__file__)

app.serve_directory(
    route="/static",
    directory_path="./static",
)


@app.get("/")
async def root(_request: Request):
    return "Hello World"


app.start(host="127.0.0.1", port=8080)