We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0445e9c commit 037c3fbCopy full SHA for 037c3fb
1 file changed
api/index.ts
@@ -25,13 +25,15 @@ const viewsEndpoint = new awsx.apigateway.API("bmpi-dev-post-views", {
25
26
console.log(`Getting count for '${route}'`);
27
28
+ let incr = event.headers["Referer"]?.includes("www.bmpi.dev") ? 1 : 0;
29
+
30
const client = new aws.sdk.DynamoDB.DocumentClient();
31
32
const result = await client.update({
33
TableName: counterTable.name.get(),
34
Key: { id: route },
35
UpdateExpression: "SET hit = if_not_exists(hit, :zero) + :incr",
- ExpressionAttributeValues: { ":zero": 0, ":incr": 1 },
36
+ ExpressionAttributeValues: { ":zero": 0, ":incr": incr },
37
ReturnValues:"UPDATED_NEW",
38
}).promise();
39
0 commit comments