Let's issue a few requests and see if our hit counter works. You can also use your web browser to do that:
curl https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/prod/ curl https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/prod/ curl https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/prod/hello curl https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/prod/hello/world curl https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/prod/hello/world
Go to the DynamoDB console.
Make sure you are in the region where you created the table.
Tables in the navigation pane and select the table that starts with
Open the table and select “Items”.
You should see how many hits you got for each path.
Try hitting a new path and refresh the Items view.
You should see a new item with a
hits count of one.
The cool thing about our
HitCounter is that it's quite useful. It basically
allows anyone to “attach” it to any Lambda function that serves as an API
Gateway proxy backend and it will log hits to this API.
Since our hit counter is a simple C# class, you could package it into an
Nuget package and publish it to nuget.org, which is the
C# package manager. Then, anyone could
dotnet add package __ it and add it to
their CDK apps.
In the next chapter we consume a construct library published to Nuget, which enables us to view the contents of our hit counter table from any browser.