Skip to content

Commit 287809a

Browse files
committed
initial commit
1 parent da8c70b commit 287809a

File tree

7 files changed

+98
-0
lines changed

7 files changed

+98
-0
lines changed

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
bin
2+
obj
3+
csx
4+
.vs
5+
edge
6+
Publish
7+
8+
*.user
9+
*.suo
10+
*.cscfg
11+
*.Cache
12+
project.lock.json
13+
14+
/packages
15+
/TestResults
16+
17+
/tools/NuGet.exe
18+
/App_Data
19+
/secrets
20+
/data
21+
.secrets
22+
appsettings.json
23+
local.settings.json
24+
25+
node_modules
26+
dist
27+
28+
# Local python packages
29+
.python_packages/
30+
31+
# Python Environments
32+
.env
33+
.venv
34+
env/
35+
venv/
36+
ENV/
37+
env.bak/
38+
venv.bak/
39+
40+
# Byte-compiled / optimized / DLL files
41+
__pycache__/
42+
*.py[cod]
43+
*$py.class

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-azuretools.vscode-azurefunctions"
4+
]
5+
}

host.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"version": "2.0"
3+
}

httpTrigger/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import logging
2+
3+
import azure.functions as func
4+
5+
6+
def main(req: func.HttpRequest) -> func.HttpResponse:
7+
logging.info('Python HTTP trigger function processed a request.')
8+
9+
name = req.params.get('name')
10+
if not name:
11+
try:
12+
req_body = req.get_json()
13+
except ValueError:
14+
pass
15+
else:
16+
name = req_body.get('name')
17+
18+
if name:
19+
return func.HttpResponse(f"Hello {name}!")
20+
else:
21+
return func.HttpResponse(
22+
"Please pass a name on the query string or in the request body",
23+
status_code=400
24+
)

httpTrigger/function.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"scriptFile": "__init__.py",
3+
"bindings": [
4+
{
5+
"authLevel": "function",
6+
"type": "httpTrigger",
7+
"direction": "in",
8+
"name": "req",
9+
"methods": [
10+
"get",
11+
"post"
12+
]
13+
},
14+
{
15+
"type": "http",
16+
"direction": "out",
17+
"name": "$return"
18+
}
19+
]
20+
}

httpTrigger/sample.dat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "Azure"
3+
}

requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)