From 9462dd446595f721fbf327d54f737905e88d9233 Mon Sep 17 00:00:00 2001 From: matv864 Date: Fri, 24 Jan 2025 02:00:04 +1000 Subject: [PATCH] start working with api --- .gitignore | 2 +- api/.python-version | 1 + api/README.md | 3 +++ api/pyproject.toml | 26 ++++++++++++++++++++++++++ api/src/app.py | 19 +++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 api/.python-version create mode 100644 api/README.md create mode 100644 api/pyproject.toml create mode 100644 api/src/app.py diff --git a/.gitignore b/.gitignore index 0dbf2f2..64afa0e 100644 --- a/.gitignore +++ b/.gitignore @@ -99,7 +99,7 @@ ipython_config.py # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. -#uv.lock +*.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. diff --git a/api/.python-version b/api/.python-version new file mode 100644 index 0000000..d9506ce --- /dev/null +++ b/api/.python-version @@ -0,0 +1 @@ +3.12.5 diff --git a/api/README.md b/api/README.md new file mode 100644 index 0000000..856a31a --- /dev/null +++ b/api/README.md @@ -0,0 +1,3 @@ +# api + +Describe your project here. diff --git a/api/pyproject.toml b/api/pyproject.toml new file mode 100644 index 0000000..07a03f6 --- /dev/null +++ b/api/pyproject.toml @@ -0,0 +1,26 @@ +[project] +name = "api" +version = "0.1.0" +description = "Add your description here" +authors = [ + { name = "matv864", email = "matv864@gmail.com" } +] +dependencies = [ + "fastapi[standard]>=0.115.7", +] +readme = "README.md" +requires-python = ">= 3.12" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.rye] +managed = true +dev-dependencies = [] + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/api"] diff --git a/api/src/app.py b/api/src/app.py new file mode 100644 index 0000000..b1c50b4 --- /dev/null +++ b/api/src/app.py @@ -0,0 +1,19 @@ +from fastapi import APIRouter, FastAPI +from fastapi.middleware.cors import CORSMiddleware + +app = FastAPI( + title="hatiko-api", +) + +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_methods=["*"], + allow_headers=["*"], +) + +main_app_router = APIRouter(prefix="/api") + +app.include_router(main_app_router) + +