Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add server demo #16

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

easypackages/__pycache__/
tests/__pycache__/
easypackages.egg-info/
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# easypackages
# easypackages

## how to build

1. pip install -r requirements.txt
2. pip install .
3. python easypackages/server.py
1 change: 0 additions & 1 deletion delta-build/readme.md

This file was deleted.

66 changes: 0 additions & 66 deletions easypackages/ai-repair/AiRepairSpec.py

This file was deleted.

1 change: 0 additions & 1 deletion easypackages/ai-repair/readme.md

This file was deleted.

File renamed without changes.
19 changes: 19 additions & 0 deletions easypackages/api/router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import json
import random
import time
from typing import Annotated, Union

from fastapi import APIRouter, Cookie, Header
from fastapi.encoders import jsonable_encoder

router = APIRouter(prefix="/v1", tags=["演示接口"])


@router.get("/demo")
async def pathParamReceive2():
"""
路径参数接收-演示-不带路径参数
"""
return {
"msg": "hello",
}
27 changes: 27 additions & 0 deletions easypackages/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from fastapi import FastAPI
from fastapi.responses import UJSONResponse

from easypackages.api.router import router


def get_app() -> FastAPI:
"""
Get FastAPI application.

This is the main constructor of an application.

:return: application.
"""
app = FastAPI(
title="easypackages server",
description="FastAPI Starter Project",
version="1.0",
docs_url="/api/docs/",
redoc_url="/api/redoc/",
openapi_url="/api/openapi.json",
default_response_class=UJSONResponse,
)

app.include_router(router=router, prefix="/api")

return app
1 change: 0 additions & 1 deletion easypackages/compassci-build/readme.md

This file was deleted.

1 change: 0 additions & 1 deletion easypackages/pkg-mapping/readme.md

This file was deleted.

18 changes: 18 additions & 0 deletions easypackages/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import uvicorn


def main() -> None:
"""Entrypoint of the application."""
server_port = 12345
uvicorn.run(
"app:get_app",
workers=1,
host="0.0.0.0",
port=server_port,
reload=False,
factory=True,
)


if __name__ == "__main__":
main()
Empty file.
232 changes: 0 additions & 232 deletions easypackages/utils/HaveProcRPM-new.sh

This file was deleted.

1 change: 0 additions & 1 deletion easypackages/utils/readme.md

This file was deleted.

Loading
Loading