mirror of
https://github.com/UofCBaja/BajaCloud.git
synced 2025-06-15 13:14:17 -06:00
feat(Packagers): testing out fastapi for performance
This commit is contained in:
parent
72fc3602d9
commit
0276fea6e7
@ -14,4 +14,34 @@ def index(request):
|
|||||||
response['X-IsBase64Encoded'] = 'false' # Custom header to indicate base64 encoding
|
response['X-IsBase64Encoded'] = 'false' # Custom header to indicate base64 encoding
|
||||||
response.status_code = 200
|
response.status_code = 200
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
from fastapi import FastAPI
|
||||||
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def index():
|
||||||
|
ymlschedule = {"message": False}
|
||||||
|
|
||||||
|
# Create the response body with multiple items
|
||||||
|
res = {
|
||||||
|
"body": {
|
||||||
|
"Schedule": ymlschedule, # FastAPI will automatically serialize the dictionary
|
||||||
|
"message": "good",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set custom headers
|
||||||
|
headers = {
|
||||||
|
"isBase64Encoded": "false", # Custom header
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return the response with the custom header
|
||||||
|
return JSONResponse(
|
||||||
|
content=res,
|
||||||
|
headers=headers,
|
||||||
|
# status_code=200 commented out just to show how to change it if you wanted
|
||||||
|
)
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user