-
-
Save rajavijaysingh/ac5caede04c79ba7c504a16574bf7f8d to your computer and use it in GitHub Desktop.
FastAPI AWS Starter Kit
This file contains hidden or 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
| from fastapi import FastAPI | |
| from starlette.middleware.cors import CORSMiddleware | |
| app = FastAPI(title="Sample FastAPI app", debug=False, version="1.0.0") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| @app.get( | |
| path="/health", description="Health check" | |
| ) | |
| def health_check(): | |
| return {"status": "OK"} |
This file contains hidden or 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
| from mangum import Mangum | |
| from fastapi_aws_starter_kit.fastapi_app import app | |
| handler = Mangum(app=app) |
This file contains hidden or 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
| org: cox65 | |
| app: fastapi-aws-starter-kit | |
| service: fastapi-aws-starter-kit | |
| package: | |
| individually: true | |
| provider: | |
| name: aws | |
| runtime: python3.9 | |
| region: eu-west-1 | |
| httpApi: | |
| cors: true | |
| timeout: 10 | |
| memorySize: 128 | |
| plugins: | |
| - serverless-python-requirements | |
| - serverless-offline | |
| functions: | |
| app: | |
| package: | |
| patterns: | |
| - "fastapi_aws_starter_kit/**" | |
| handler: fastapi_aws_starter_kit.handler.handler | |
| events: | |
| - http: | |
| method: any | |
| path: /{proxy+} | |
| cors: true | |
| custom: | |
| pythonRequirements: | |
| dockerizePip: true |
This file contains hidden or 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
| import os | |
| import uvicorn | |
| if __name__ == "__main__": | |
| uvicorn.run( | |
| "fastapi_app:app", | |
| host="127.0.0.1", | |
| port=5000, | |
| reload=True, | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment