diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 7f30650..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# Find the Dockerfile for mcr.microsoft.com/azure-functions/node at the following URLs: -# Node 10: https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/node/node10/node10-core-tools.Dockerfile -# Node 12: https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/node/node12/node12-core-tools.Dockerfile -ARG VARIANT=12 -FROM mcr.microsoft.com/azure-functions/node:3.0-node${VARIANT}-core-tools - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 89b1472..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "Azure Functions & Node.js", - "build": { - "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick a Node.js version: 10, 12 - "args": { - "VARIANT": "12" - } - }, - "forwardPorts": [ - 7071, - 3000 - ], - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-azuretools.vscode-azurefunctions", - "ms-azuretools.vscode-azurestaticwebapps", - "dbaeumer.vscode-eslint" - ], - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm install", - // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "node" -} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 26786f9..8694efd 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,7 @@ { "recommendations": [ - "ms-azuretools.vscode-azurefunctions" + "ms-azuretools.vscode-azurefunctions", + "ms-azuretools.vscode-azurestaticwebapps" ] } + diff --git a/.vscode/settings.json b/.vscode/settings.json index bc8c902..aa0ac87 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,6 @@ "azureFunctions.projectLanguage": "JavaScript", "azureFunctions.projectRuntime": "~3", "debug.internalConsoleOptions": "neverOpen", - "azureFunctions.preDeployTask": "npm prune" + "azureFunctions.preDeployTask": "npm prune", + "python.pythonPath": "/usr/bin/python3" } \ No newline at end of file diff --git a/README.md b/README.md index 54ef094..3f869d5 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,41 @@ -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +# Static Web App -## Available Scripts +Update readme. -In the project directory, you can run: +Update readme for PR! -### `npm start` +## Setup -Runs the app in the development mode.
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +1. Install the Azure Functions extension. -The page will reload if you make edits.
-You will also see any lint errors in the console. +1. Run the following to install Azure Functions Core Tools. -### `npm test` + ``` + npm i -g azure-functions-core-tools@3 --unsafe-perm true + ``` -Launches the test runner in the interactive watch mode.
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. +## Run the application -### `npm run build` +1. The frontend is a React app which is run with... -Builds the app for production to the `build` folder.
-It correctly bundles React in production mode and optimizes the build for the best performance. + ``` + npm start + ``` -The build is minified and the filenames include the hashes.
-Your app is ready to be deployed! +1. The backend is a Functions project that should be started from the run and debug panel. -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. +> If you receive an error about "unable to decrypt settings" when trying to run the backend/Functions project, make sure the "IsEncryped" option is set to false in your "api/local.settings.json" file. It is a top level setting outside of "Values"... -### `npm run eject` + ``` + { + "IsEncrypted": false, + "Values": { + "FUNCTIONS_WORKER_RUNTIME": "node", + } + } + ``` -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. +## Forward ports -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting - -### Analyzing the Bundle Size - -This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size - -### Making a Progressive Web App - -This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app - -### Advanced Configuration - -This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration - -### Deployment - -This section has moved here: https://facebook.github.io/create-react-app/docs/deployment - -### `npm run build` fails to minify - -This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify +1. Forward ports 3000 and 7071 diff --git a/src/App.js b/src/App.js index 8986ab0..1a8dcb5 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,5 @@ -import React, { useEffect, useState } from 'react'; -import axios from 'axios'; +import React, { useEffect, useState } from "react"; +import axios from "axios"; const App = () => { const [products, setProducts] = useState([]); @@ -7,13 +7,13 @@ const App = () => { useEffect(() => { async function getProducts() { - const response = await axios.get('api/products'); + const response = await axios.get("api/products"); setProducts(response.data); setLoading(false); } getProducts(); - }, []) + }, []); return (
@@ -39,46 +39,33 @@ const App = () => { - {products.map(({ id, name, brand, price, stockUnits }, index) => ( - - - - - - - - - - - - - - - ))} + {products.map( + ({ id, name, brand, price, stockUnits }, index) => ( + + {name} + {brand.name} + {price} + {stockUnits} + + ) + )} {loading ? (

Loading...

- - ) : ''} + ) : ( + "" + )}

Unable to reach API

- - - + + + ); -} +}; export default App; diff --git a/src/index.js b/src/index.js index 6fd9048..96664ef 100644 --- a/src/index.js +++ b/src/index.js @@ -14,6 +14,6 @@ ReactDOM.render( ); // If you want your app to work offline and load faster, you can change -// unregister() to register() below. Note this comes with some pitfalls. +// unregister() to register() below. Note this comes with some pitfalls // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister();