Skip to content

Commit 4ba0e2e

Browse files
authored
remove _user_request_ from endpoints for NextGen (#14)
1 parent 321ae0b commit 4ba0e2e

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The output will be:
5656

5757
```bash
5858
CloudFront URL: https://1e372b81.cloudfront.localhost.localstack.cloud
59-
API Gateway Endpoint: http://localhost:4566/_aws/execute-api/4xu5emxibf/test/_user_request_
59+
API Gateway Endpoint: http://localhost:4566/_aws/execute-api/4xu5emxibf/test
6060
```
6161

6262
Navigate to the CloudFront URL to check out the app. The script would also seed some quiz data and user data to make local testing easier.

bin/deploy.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ FUNCTIONS=(
9191
log "Creating IAM policies and roles for Lambda functions..."
9292
for FUNCTION_INFO in "${FUNCTIONS[@]}"; do
9393
read FUNCTION_NAME POLICY_FILE ROLE_NAME <<< "$FUNCTION_INFO"
94-
94+
9595
log "Creating IAM policy for $FUNCTION_NAME..."
9696
awslocal iam create-policy \
9797
--policy-name ${FUNCTION_NAME}Policy \
9898
--policy-document file://${POLICY_FILE} >/dev/null
99-
99+
100100
log "Creating IAM role $ROLE_NAME..."
101101
ROLE_ARN=$(awslocal iam create-role \
102102
--role-name ${ROLE_NAME} \
103103
--assume-role-policy-document file://configurations/lambda_trust_policy.json \
104104
--query 'Role.Arn' --output text)
105-
105+
106106
log "Attaching policy to role $ROLE_NAME..."
107107
awslocal iam attach-role-policy \
108108
--role-name ${ROLE_NAME} \
@@ -141,7 +141,7 @@ LAMBDAS=(
141141

142142
for LAMBDA_INFO in "${LAMBDAS[@]}"; do
143143
read FUNCTION_NAME ZIP_FILE ROLE_NAME <<< "$LAMBDA_INFO"
144-
144+
145145
log "Creating Lambda function $FUNCTION_NAME..."
146146
awslocal lambda create-function \
147147
--function-name ${FUNCTION_NAME} \
@@ -190,21 +190,21 @@ ENDPOINTS=(
190190

191191
for ENDPOINT_INFO in "${ENDPOINTS[@]}"; do
192192
read PATH_PART HTTP_METHOD FUNCTION_NAME <<< "$ENDPOINT_INFO"
193-
193+
194194
log "Setting up API endpoint /$PATH_PART [$HTTP_METHOD] -> $FUNCTION_NAME"
195-
195+
196196
RESOURCE_ID=$(awslocal apigateway create-resource \
197197
--rest-api-id $API_ID \
198198
--parent-id $PARENT_ID \
199199
--path-part $PATH_PART \
200200
--query 'id' --output text)
201-
201+
202202
awslocal apigateway put-method \
203203
--rest-api-id $API_ID \
204204
--resource-id $RESOURCE_ID \
205205
--http-method $HTTP_METHOD \
206206
--authorization-type "NONE" >/dev/null
207-
207+
208208
awslocal apigateway put-integration \
209209
--rest-api-id $API_ID \
210210
--resource-id $RESOURCE_ID \
@@ -220,7 +220,7 @@ log "Deploying API..."
220220
awslocal apigateway create-deployment \
221221
--rest-api-id $API_ID \
222222
--stage-name test >/dev/null
223-
API_ENDPOINT="http://localhost:4566/_aws/execute-api/$API_ID/test/_user_request_"
223+
API_ENDPOINT="http://localhost:4566/_aws/execute-api/$API_ID/test"
224224
log "API deployed. Endpoint: $API_ENDPOINT"
225225

226226
# SQS DLQ -> EventBridge Pipes -> SNS
@@ -348,7 +348,7 @@ LAMBDA_PERMISSIONS=(
348348

349349
for PERMISSION_INFO in "${LAMBDA_PERMISSIONS[@]}"; do
350350
read FUNCTION_NAME HTTP_METHOD PATH_PART <<< "$PERMISSION_INFO"
351-
351+
352352
log "Adding permission for $FUNCTION_NAME to be invoked by API Gateway..."
353353
awslocal lambda add-permission \
354354
--function-name ${FUNCTION_NAME} \

bin/seed.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ if [ -z "$API_ID" ]; then
2525
exit 1
2626
fi
2727

28-
API_ENDPOINT="$AWS_ENDPOINT_URL/_aws/execute-api/$API_ID/test/_user_request_"
28+
API_ENDPOINT="$AWS_ENDPOINT_URL/_aws/execute-api/$API_ID/test"
2929

3030
create_quiz() {
3131
local quiz_data=$1
3232
local response=$(curl -s -X POST "$API_ENDPOINT/createquiz" \
3333
-H "Content-Type: application/json" \
3434
-d "$quiz_data")
35-
35+
3636
if [ "$(echo $response | jq -r 'has("QuizID")')" = "true" ]; then
3737
local quiz_id=$(echo $response | jq -r '.QuizID')
3838
log "Created quiz with ID: $quiz_id"

frontend/scripts/populate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ -z "$API_ID" ]; then
1414
exit 1
1515
fi
1616

17-
API_ENDPOINT="$AWS_ENDPOINT_URL/_aws/execute-api/$API_ID/test/_user_request_"
17+
API_ENDPOINT="$AWS_ENDPOINT_URL/_aws/execute-api/$API_ID/test"
1818

1919
echo "REACT_APP_API_ENDPOINT=$API_ENDPOINT" > .env.local
2020

tests/test_infra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def api_endpoint():
1919
raise Exception(f"API {API_NAME} not found.")
2020

2121
API_ID = api['id']
22-
API_ENDPOINT = f"http://localhost:4566/_aws/execute-api/{API_ID}/test/_user_request_"
22+
API_ENDPOINT = f"http://localhost:4566/_aws/execute-api/{API_ID}/test"
2323

2424
print(f"API Endpoint: {API_ENDPOINT}")
2525

tests/test_outage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def api_endpoint(apigateway_client):
2828
raise Exception(f"API {API_NAME} not found.")
2929

3030
API_ID = api['id']
31-
API_ENDPOINT = f"{LOCALSTACK_ENDPOINT}/_aws/execute-api/{API_ID}/test/_user_request_"
31+
API_ENDPOINT = f"{LOCALSTACK_ENDPOINT}/_aws/execute-api/{API_ID}/test"
3232

3333
print(f"API Endpoint: {API_ENDPOINT}")
3434

@@ -38,11 +38,11 @@ def api_endpoint(apigateway_client):
3838

3939
def test_dynamodb_outage(api_endpoint):
4040
outage_rule = FaultRule(region="us-east-1", service="dynamodb")
41-
41+
4242
# Using fault_configuration context manager to apply and automatically clean up the fault rule
4343
with fault_configuration(fault_rules=[outage_rule]):
4444
print("DynamoDB outage initiated within context.")
45-
45+
4646
# Attempt to create a quiz during the outage
4747
create_quiz_payload = {
4848
"Title": "Outage Test Quiz",

0 commit comments

Comments
 (0)