Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify demo app CORS setup, use S3 website instead of Web server #47

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
export DOCKER_BRIDGE ?= $(shell (uname -a | grep Linux > /dev/null) && echo 172.17.0.1 || echo docker.for.mac.localhost)
export SERVICES = serverless,cloudformation,sts,stepfunctions,sqs
export AWS_ACCESS_KEY_ID ?= test
export AWS_SECRET_ACCESS_KEY ?= test
export AWS_DEFAULT_REGION = us-east-1
export START_WEB ?= 1

usage: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
Expand All @@ -18,14 +15,6 @@ deploy: ## Deploy the app
echo "Deploying Serverless app to local environment"; \
SLS_DEBUG=1 serverless deploy --stage local

start: ## Deploy and start the app locally
@make deploy; make web

web: ## Start Web app in browser
@make install; \
echo "Starting Web app - open this page in your browser: http://localhost:3000"; \
npm run web

send-request: ## Send a test request to the deployed application
@echo Looking up API ID from deployed API Gateway REST APIs ...; \
apiId=$$(awslocal apigateway get-rest-apis | jq -r '.items[] | select(.name="local-localstack-demo") | .id'); \
Expand All @@ -38,4 +27,4 @@ lint: ## Run code linter
@npm run lint
@flake8 demo

.PHONY: usage install start lint
.PHONY: usage install deploy send-request lint
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The sample app illustrates a typical Web application scenario with asynchronous
* Node.js / `npm`
* `make`

**Note:** Make sure to start LocalStack with the `EXTRA_CORS_ALLOWED_ORIGINS=http://localhost:3000` config enabled, to ensure the demo Web application can access the local APIs from the browser.
Note: Please make sure to pull and start the `latest` LocalStack Docker image. At the time of writing (2023-02-01), the demo requires some features that were only recently added to LocalStack and are not part of a tagged release version yet.

## Installing

Expand All @@ -26,14 +26,14 @@ make install

## Running

Start the application locally in LocalStack:
To deploy and start the application locally in LocalStack:
```
make start
make deploy
```

## Testing

After starting the app, open this URL in your browser: http://localhost:3000
After starting the app, open this URL in your browser: http://localhost:4566/archive-bucket/index.html

* Enable the option "Auto-Refresh" to continuously poll for new results
* Click the button "Create new request" to send a new request to the backend API
Expand Down
Loading