Skip to content

Commit

Permalink
Add function app which delegates requests to Flask
Browse files Browse the repository at this point in the history
  • Loading branch information
steventux committed Jan 9, 2025
1 parent 0eb293a commit ce8fda8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions function_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import azure.functions as func
from app import create_app

funcapp = func.FunctionApp()
flaskapp = create_app()


@funcapp.route(
route="{*route}",
auth_level=func.AuthLevel.ANONYMOUS,
methods=[func.HttpMethod.GET, func.HttpMethod.POST],
)
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.WsgiMiddleware(flaskapp.wsgi_app).handle(req, context)
8 changes: 8 additions & 0 deletions host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}

7 changes: 7 additions & 0 deletions local.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
}
}

0 comments on commit ce8fda8

Please sign in to comment.