+++ title = "Add the table viewer to your app" weight = 300 +++ ## Add a table viewer to your stack Add the following hightlighted lines to `cdk-workshop.go` to add a `TableViewer` construct to your stack: {{}} package main import ( "github.com/aws/aws-cdk-go/awscdk/v2" "github.com/aws/aws-cdk-go/awscdk/v2/awslambda" "github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway" "github.com/aws/constructs-go/constructs/v10" "github.com/aws/jsii-runtime-go" "cdk-workshop/hitcounter" "github.com/cdklabs/cdk-dynamo-table-viewer-go/dynamotableviewer" ) type CdkWorkshopStackProps struct { awscdk.StackProps } func NewCdkWorkshopStack(scope constructs.Construct, id string, props *CdkWorkshopStackProps) awscdk.Stack { var sprops awscdk.StackProps if props != nil { sprops = props.StackProps } stack := awscdk.NewStack(scope, &id, &sprops) helloHandler := awslambda.NewFunction(stack, jsii.String("HelloHandler"), &awslambda.FunctionProps{ Code: awslambda.Code_FromAsset(jsii.String("lambda"), nil), Runtime: awslambda.Runtime_NODEJS_16_X(), Handler: jsii.String("hello.handler"), }) hitcounter := hitcounter.NewHitCounter(stack, "HelloHitCounter", &hitcounter.HitCounterProps{ Downstream: helloHandler, }) awsapigateway.NewLambdaRestApi(stack, jsii.String("Endpoint"), &awsapigateway.LambdaRestApiProps{ Handler: hitcounter.Handler(), }) dynamotableviewer.NewTableViewer(stack, jsii.String("ViewHitCounter"), &dynamotableviewer.TableViewerProps{ Title: jsii.String("Hello Hits"), Table: //????? }) return stack } func main() { defer jsii.Close() app := awscdk.NewApp(nil) NewCdkWorkshopStack(app, "CdkWorkshopStack", &CdkWorkshopStackProps{}) app.Synth(nil) } {{}} ## What about the table? As you'll notice, `TableViewer` requires that you specify a `Table` property. What we want is to somehow access the DynamoDB table behind our hit counter. However, the current API of our hit counter doesn't expose the table as a public member. --- In the next section, we'll expose our table as a property of `HitCounter` so we can access it from our stack.