fast api server
This commit is contained in:
9
.gitignore
vendored
9
.gitignore
vendored
@@ -17,7 +17,8 @@ logs
|
|||||||
*.log
|
*.log
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
.venv*
|
venv*
|
||||||
|
__pycache__
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@@ -25,6 +26,6 @@ logs
|
|||||||
.idea
|
.idea
|
||||||
|
|
||||||
# Local env files
|
# Local env files
|
||||||
.env
|
#.env
|
||||||
.env.*
|
#.env.*
|
||||||
!.env.example
|
#!.env.example
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ from fastapi import FastAPI, HTTPException
|
|||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
import pymysql
|
||||||
|
|
||||||
|
class mysql_params:
|
||||||
|
host = "127.0.0.1"
|
||||||
|
user = "yt2mp3_nuxt"
|
||||||
|
db = "yt2mp3_nuxt"
|
||||||
|
pwd = "ultratopsecret,bro"
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
@@ -19,6 +26,8 @@ class MeData(BaseModel):
|
|||||||
profile_picture: Optional[str] = None
|
profile_picture: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/convert")
|
@app.post("/convert")
|
||||||
async def convert_endpoint(data: ConversionData):
|
async def convert_endpoint(data: ConversionData):
|
||||||
"""
|
"""
|
||||||
@@ -70,4 +79,4 @@ async def me_post_endpoint(data: MeData):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
uvicorn.run(app, host="127.0.0.1", port=8003)
|
||||||
14
server/fastapi_server/requirements.txt
Normal file
14
server/fastapi_server/requirements.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
annotated-doc==0.0.4
|
||||||
|
annotated-types==0.7.0
|
||||||
|
anyio==4.12.1
|
||||||
|
click==8.3.1
|
||||||
|
fastapi==0.128.0
|
||||||
|
h11==0.16.0
|
||||||
|
idna==3.11
|
||||||
|
pydantic==2.12.5
|
||||||
|
pydantic_core==2.41.5
|
||||||
|
PyMySQL==1.1.2
|
||||||
|
starlette==0.50.0
|
||||||
|
typing-inspection==0.4.2
|
||||||
|
typing_extensions==4.15.0
|
||||||
|
uvicorn==0.40.0
|
||||||
Reference in New Issue
Block a user