-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
126 additions
and
784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.