File tree Expand file tree Collapse file tree 5 files changed +555
-3
lines changed Expand file tree Collapse file tree 5 files changed +555
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ jupyterlab: ## run Jupyter Lab
58
58
# ---
59
59
DOCKER_REPO_NAME ?= ks6088ts
60
60
DOCKER_IMAGE_NAME ?= template-fastapi
61
- DOCKER_COMMAND ?=
61
+ DOCKER_COMMAND ?= fastapi run main.py --help
62
62
63
63
# Tools
64
64
TOOLS_DIR ?= /usr/local/bin
@@ -103,3 +103,20 @@ docs-serve: ## serve documentation
103
103
104
104
.PHONY : ci-test-docs
105
105
ci-test-docs : docs # # run CI test for documentation
106
+
107
+ # ---
108
+ # Project
109
+ # ---
110
+
111
+ .PHONY : run
112
+ run : # # run FastAPI server
113
+ uv run fastapi run main.py \
114
+ --host 0.0.0.0 \
115
+ --port 8000
116
+
117
+ .PHONY : dev
118
+ dev : # # run FastAPI server in development mode
119
+ uv run fastapi dev main.py \
120
+ --host 0.0.0.0 \
121
+ --port 8000 \
122
+ --reload
Original file line number Diff line number Diff line change 1
1
# template-fastapi
2
+
3
+ ## FastAPI
4
+
5
+ - [ FastAPI] ( https://fastapi.tiangolo.com/ )
Original file line number Diff line number Diff line change
1
+ from fastapi import FastAPI
2
+
3
+ app = FastAPI ()
4
+
5
+
6
+ @app .get ("/" )
7
+ def read_root ():
8
+ return {"Hello" : "World" }
9
+
10
+
11
+ @app .get ("/items/{item_id}" )
12
+ def read_item (item_id : int , q : str | None = None ):
13
+ return {"item_id" : item_id , "q" : q }
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ version = "0.0.1"
4
4
description = " A GitHub template repository for Python"
5
5
readme = " README.md"
6
6
requires-python = " >=3.10"
7
- dependencies = []
7
+ dependencies = [
8
+ " fastapi[standard]>=0.115.12" ,
9
+ ]
8
10
9
11
[project .optional-dependencies ]
10
12
docs = [
You can’t perform that action at this time.
0 commit comments