| 1 |
from typing import Dict |
| 2 |
|
| 3 |
from litestar import Litestar, get |
| 4 |
from litestar.openapi.config import OpenAPIConfig |
| 5 |
from litestar.openapi.plugins import SwaggerRenderPlugin |
| 6 |
|
| 7 |
|
| 8 |
@get("/", sync_to_thread=False) |
| 9 |
def hello_world() -> Dict[str, str]: |
| 10 |
return {"message": "Hello World"} |
| 11 |
|
| 12 |
|
| 13 |
app = Litestar( |
| 14 |
route_handlers=[hello_world], |
| 15 |
openapi_config=OpenAPIConfig( |
| 16 |
title="Litestar Example", |
| 17 |
description="Example of litestar", |
| 18 |
version="0.0.1", |
| 19 |
render_plugins=[SwaggerRenderPlugin()], |
| 20 |
), |
| 21 |
) |