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

Fast API configured and deployed #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions FastAPIApp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import fastapi

app = fastapi.FastAPI()

# TODO: Add setup or configuration specifications for the application here
6 changes: 5 additions & 1 deletion host.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
"version": "[2.*, 4.0.0)"
},
"concurrency": {
"dynamicConcurrencyEnabled": false,
"snapshotPersistenceEnabled": false
},
"functionTimeout": "00:10:00",
"extensions": {
"http":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will affect the other functions deployed within this app, right?

Can we double check that the call to http-parser function still works? There are instructions in the readme on how to run the other functions locally. At a minimum, we should make sure the http-parser function logs that it received a request.

{
"routePrefix": ""
},
"queues": {
"maxPollingInterval": "00:00:30",
"visibilityTimeout" : "00:00:30",
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# Manually managing azure-functions-worker may cause unexpected issues

azure-cosmos
azure-functions==1.12.0
azure-functions>=1.12.0
azure-identity
azure-storage-blob==12.14.1
fastapi
requests
bs4
xxhash
21 changes: 21 additions & 0 deletions wrapper-function/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import logging
import azure.functions as func
from FastAPIApp import app # Main API application


@app.get("/sample")
async def index():
return {
"info": "Try /hello/K for parameterized route.",
}


@app.get("/hello/{name}")
async def get_name(name: str):
return {
"name": name,
}


async def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return await func.AsgiMiddleware(app).handle_async(req, context)
21 changes: 21 additions & 0 deletions wrapper-function/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
],
"route": "{*route}"
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}