This is a demo React full-stack web application that uses Azure Functions to provide a REST API. The application is deployed to a single Azure Static Web Apps resource, and makes use of Static Web Apps' Functions integration to host the Azure Functions API.
To get started with local development, first install the dependencies:
npm install -g @azure/static-web-apps-cli
npm install
cd api
npm installNow, from the root of the project, run the following command to start the application:
swa start http://localhost:5173 --run "npm run dev" --api-location ./apiAccess the application at http://localhost:4280.
To deploy to Azure Static Web Apps, create a Static Web Apps resource from the Azure Portal. Specify '/' as the app location, 'api' as the API location, and 'dist' as the output location.
Set the following environment variables in the Static Web Apps resource from the Azure Portal:
"COSMOSDB_KEY": "", "COSMOSDB_ENDPOINT": "",