This repository was archived by the owner on Jul 11, 2024. It is now read-only.
Open
Conversation
The API Gateway endpoint to serve the s3 content was configured from the AWS console. Hopefully will be able to incorporate this with serverless config
Contributor
Author
|
The API Gateway endpoint is configured to serve the s3 content from the AWS console. Hopefully will be able to incorporate this with serverless config. This is far from perfect, but it's working: https://p9r1atzsrf.execute-api.us-east-1.amazonaws.com/dev/hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch is an experiment with doing server-side rendering with react + mounting/hydrating on the front end. Right now it's only a proof of concept built for local development (for deployment, would need to decide where to host static js build files for front end, for example), but locally it works.
To try it, run:
This runs
serverless-webpack's local dev server along with a separatewebpack-dev-serverto serve the front-end build.Then load
localhost:8000/helloin your browser. You should see aHello worldpage. Click on that and the text changes toHello Adam(uhh I hope your name is also Adam). I just did that to verify that the app had mounted as expected on the front end.Oh, and also:
If your request headers 'accept' common html request headers (e.g.,
text/htmland one other b/c IE is weird), you will be served html. If not, you will be served JSON. So, for example, if you were to run:You would instead get a response of:
{ "name":"World" }If instead you were to run:
curl -H "accept: text/html" http://localhost:8000/helloYou'd get the html:
You get the idea.