Demo for showcasing a simple React based SPA and backend API deployed to SWA.
Combines a couple of examples from the MS docs
- https://learn.microsoft.com/en-us/azure/static-web-apps/add-api?tabs=react
- https://learn.microsoft.com/en-us/azure/static-web-apps/get-started-cli?tabs=react
npm install -g azure-functions-core-tools
npm install -g @azure/static-web-apps-cli
npm run build
swa start client/build --api-location api
In another terminal:
npm run start
In main terminal:
swa start http://localhost:3000/ --api-location api
curl http://localhost:7071/api/message
{
"text": "Hello from the API"
}
az login
az group create \
--name my-swa-group \
--location "westeurope"
az staticwebapp create \
--name swa-demo-app \
--resource-group my-swa-group \
--location "westeurope"
swa deploy client/build --api-location ./api --app-name swa-demo-app