diff --git a/api-starter/.funcignore b/api/.funcignore similarity index 100% rename from api-starter/.funcignore rename to api/.funcignore diff --git a/api-starter/.gitignore b/api/.gitignore similarity index 100% rename from api-starter/.gitignore rename to api/.gitignore diff --git a/api-starter/README.md b/api/README.md similarity index 100% rename from api-starter/README.md rename to api/README.md diff --git a/api-starter/host.json b/api/host.json similarity index 77% rename from api-starter/host.json rename to api/host.json index d342a8e..c4ae96f 100644 --- a/api-starter/host.json +++ b/api/host.json @@ -2,6 +2,6 @@ "version": "2.0", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[1.*, 2.0.0)" + "version": "[2.*, 3.0.0)" } } diff --git a/api-starter/package-lock.json b/api/package-lock.json similarity index 100% rename from api-starter/package-lock.json rename to api/package-lock.json diff --git a/api-starter/package.json b/api/package.json similarity index 100% rename from api-starter/package.json rename to api/package.json diff --git a/api-starter/products-delete/function.json b/api/products-delete/function.json similarity index 100% rename from api-starter/products-delete/function.json rename to api/products-delete/function.json diff --git a/api-starter/products-delete/index.js b/api/products-delete/index.js similarity index 100% rename from api-starter/products-delete/index.js rename to api/products-delete/index.js diff --git a/api/products-get/function.json b/api/products-get/function.json new file mode 100644 index 0000000..72a6566 --- /dev/null +++ b/api/products-get/function.json @@ -0,0 +1,19 @@ +{ + "bindings": [ + { + "authLevel": "anonymous", + "type": "httpTrigger", + "direction": "in", + "name": "req", + "methods": [ + "get" + ], + "route": "products" + }, + { + "type": "http", + "direction": "out", + "name": "res" + } + ] +} \ No newline at end of file diff --git a/api/products-get/index.js b/api/products-get/index.js new file mode 100644 index 0000000..21cc04e --- /dev/null +++ b/api/products-get/index.js @@ -0,0 +1,11 @@ +const data = require('../shared/product-data'); + +module.exports = async function (context, req) { + try { + const products = data.getProducts(); + context.res.status(200).json(products); + } + catch (error) { + context.res.status(500).send(error); + } +} diff --git a/api/products-get/sample.dat b/api/products-get/sample.dat new file mode 100644 index 0000000..2e60943 --- /dev/null +++ b/api/products-get/sample.dat @@ -0,0 +1,3 @@ +{ + "name": "Azure" +} \ No newline at end of file diff --git a/api-starter/products-post/function.json b/api/products-post/function.json similarity index 100% rename from api-starter/products-post/function.json rename to api/products-post/function.json diff --git a/api-starter/products-post/index.js b/api/products-post/index.js similarity index 100% rename from api-starter/products-post/index.js rename to api/products-post/index.js diff --git a/api-starter/products-put/function.json b/api/products-put/function.json similarity index 100% rename from api-starter/products-put/function.json rename to api/products-put/function.json diff --git a/api-starter/products-put/index.js b/api/products-put/index.js similarity index 100% rename from api-starter/products-put/index.js rename to api/products-put/index.js diff --git a/api-starter/proxies.json b/api/proxies.json similarity index 100% rename from api-starter/proxies.json rename to api/proxies.json diff --git a/api-starter/shared/product-data.js b/api/shared/product-data.js similarity index 100% rename from api-starter/shared/product-data.js rename to api/shared/product-data.js