This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
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-server
to serve the front-end build.Then load
localhost:8000/hello
in your browser. You should see aHello world
page. 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/html
and 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:
If instead you were to run:
curl -H "accept: text/html" http://localhost:8000/hello
You'd get the html:
You get the idea.