diff template.yaml @ 7:7c5fb7573dd8

first working version
author Dennis C. M. <dennis@denniscm.com>
date Mon, 05 Jun 2023 19:06:34 +0100
parents d15ccf5f1373
children f2442b8f43de
line wrap: on
line diff
--- a/template.yaml	Mon Jun 05 17:12:18 2023 +0100
+++ b/template.yaml	Mon Jun 05 19:06:34 2023 +0100
@@ -120,6 +120,10 @@
     Type: AWS::Serverless::Api
     Properties:
       StageName: Prod
+      Cors:
+        AllowMethods: "'GET, POST, OPTIONS'"
+        AllowHeaders: "'content-type, x-api-key'"
+        AllowOrigin: "'*'"
       Models:
         Empty:
           type: object
@@ -150,6 +154,25 @@
           Permissions:
             - Read
 
+  GetTickersFunction:
+    Type: AWS::Serverless::Function
+    Properties:
+      CodeUri: get_tickers/
+      Events:
+        GetProductEvent:
+          Type: Api
+          Properties:
+            RestApiId: !Ref Api
+            Path: /tickers
+            Method: get
+    Connectors:
+      DynamoConnector:
+        Properties:
+          Destination:
+            Id: DynamoTable
+          Permissions:
+            - Read
+
   DynamoTable:
     Type: AWS::DynamoDB::Table
     Properties:
@@ -173,4 +196,8 @@
 Outputs:
   GetReportEndpoint:
     Description: "Endpoint to get a report"
-    Value: !Sub "https://${Api}.execute-api.${AWS::Region}.amazonaws.com/Prod/report"
\ No newline at end of file
+    Value: !Sub "https://${Api}.execute-api.${AWS::Region}.amazonaws.com/Prod/report"
+
+  GetTickersEndpoint:
+    Description: "Endpoint to get tickers"
+    Value: !Sub "https://${Api}.execute-api.${AWS::Region}.amazonaws.com/Prod/ticker"
\ No newline at end of file