This code provisions an Azure AppService website powered by Azure Functions, and uses Azure Storage to store the hit counter. All infrastructure is "serverless" and pay per usage so there aren't any persistent servers. The project is defined in TypeScript infrastructure as code so that it's easy to spin up and tear down environments without manual steps.
Here is a live instance: https://site7bb58a26.azurewebsites.net/api/site
To get it up and running:
- Clone the repo and
cd
into it - Install Pulumi
- Run
pulumi stack init
to create a new stack - Run
pulumi config set azure:location WestUS
to initialize the region (feel free to choose an alternate) - Run
pulumi up
- Now the website is running, visit it by going to the URL printed by
pulumi stack output url